generated from seqan/app-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Add sharg::istreamable concept. (#53)
* [MISC] Move argument_parser_compatible_option to concept.hpp * [FEATURE] Add sharg istreamable concept. * [MISC] Remove dependency on seqan3::input_stream_over. * add return type constraint * Update include/sharg/concept.hpp * Update include/sharg/concept.hpp * remove todo Co-authored-by: Enrico Seiler <[email protected]>
- Loading branch information
1 parent
5db7c35
commit 3acbd1d
Showing
3 changed files
with
56 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// ----------------------------------------------------------------------------------------------------------- | ||
// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin | ||
// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik | ||
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License | ||
// shipped with this file and also available at: https://github.com/seqan/sharg-parser/blob/master/LICENSE.md | ||
// ----------------------------------------------------------------------------------------------------------- | ||
|
||
/*!\file | ||
* \author Svenja Mehringer <svenja.mehringer AT fu-berlin.de> | ||
* \brief Provides helper concepts. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <seqan3/std/concepts> | ||
|
||
#include <sharg/auxiliary.hpp> | ||
|
||
namespace sharg | ||
{ | ||
|
||
/*!\concept sharg::istreamable | ||
* \ingroup argument_parser | ||
* \brief Concept for types that can be parsed from a std::istream via the stream operator. | ||
* \tparam value_type The type to check whether it's stremable via std::istream. | ||
* | ||
* ### Requirements | ||
* | ||
* `std::istream` must support the (un)formatted input function (`operator>>`) for an l-value of a given `value_type`. | ||
*/ | ||
template <typename value_type> | ||
concept istreamable = requires (std::istream & is, value_type & val) | ||
{ | ||
SHARG_RETURN_TYPE_CONSTRAINT(is >> val, std::same_as, std::istream&); | ||
}; | ||
|
||
/*!\concept sharg::argument_parser_compatible_option | ||
* \brief Checks whether the the type can be used in an add_(positional_)option call on the argument parser. | ||
* \ingroup argument_parser | ||
* \tparam option_type The type to check. | ||
* | ||
* ### Requirements | ||
* | ||
* In order to model this concept, the type must either model sharg::istreamable and sharg::ostreamable or | ||
* model sharg::named_enumeration<option_type>. | ||
* | ||
* \remark For a complete overview, take a look at \ref argument_parser | ||
*/ | ||
template <typename option_type> | ||
concept argument_parser_compatible_option = sharg::istreamable<option_type> || named_enumeration<option_type>; | ||
|
||
} // namespace sharg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3acbd1d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: