senf::console::CheckedArgumentIteratorWrapper Class Reference
Wrapper checking argument iterator access for validity.
More...
#include <senf/Utils/Console/Parse.hh>
List of all members.
Detailed Description
Wrapper checking argument iterator access for validity.
CheckedArgumentIteratorWrapper is a wrapper around a range of arguments parsed using the ParseCommandInfo::ArgumentIterator. It is used to parse arguments either in a command (registered with manual argument parsing) or when defining a custom parser.
To use the wrapper, you must ensure that:
- You increment the iterator past all arguments you parse. The iterator must point to the end of the range when parsing is complete.
- The iterator wrapper is destroyed after parsing but before executing the command itself begins.
Accessing a non-existent argument or failing to parse all arguments will raise a
senf::console::SyntaxErrorException.
- See also:
- Example customer parser
Definition at line 493 of file Parse.hh.
Constructor & Destructor Documentation
senf::console::CheckedArgumentIteratorWrapper:: |
CheckedArgumentIteratorWrapper |
( |
ParseCommandInfo::ArgumentsRange const & |
range, |
|
|
|
std::string const & |
msg = "invalid number of arguments"
|
) |
|
senf::console::CheckedArgumentIteratorWrapper:: |
CheckedArgumentIteratorWrapper |
( |
ParseCommandInfo::TokensRange const & |
range, |
|
|
|
std::string const & |
msg = "invalid number of arguments"
|
) |
|
senf::console::CheckedArgumentIteratorWrapper:: |
~CheckedArgumentIteratorWrapper |
() |
|
|
|
|
Check, if all arguments are parsed.
The destructor validates, that all arguments are parsed correctly when leaving the scope, in which the wrapper is instantiated normally (not by an exception).
- Warning:
- This destructor will throw a SyntaxErrorException, if not all arguments are parsed and when no other exception is in progress.
Definition at line 261 of file Parse.cci.
Member Function Documentation
bool senf::console::CheckedArgumentIteratorWrapper:: |
boolean_test |
() |
|
|
|
|
true
, if more arguments are available
Definition at line 272 of file Parse.cci.
void senf::console::CheckedArgumentIteratorWrapper:: |
clear |
() |
|
|
|
|
Set range empty.
This call will point the current iterator to the end of the tokens range.
- Postcondition:
-
done() ==
true
;
Definition at line 284 of file Parse.cci.
bool senf::console::CheckedArgumentIteratorWrapper:: |
done |
() |
|
|
|
|
true
, if all arguments are parsed
Definition at line 278 of file Parse.cci.
senf::console::CheckedArgumentIteratorWrapper::operator ParseCommandInfo:: |
ArgumentIterator |
() |
|
|
|
|
Compare wrapper against ArgumentIterator.
Definition at line 313 of file Parse.cci.
Compare wrapper against ArgumentIterator.
Definition at line 306 of file Parse.cci.
The documentation for this class was generated from the following files: