C++ Utilities 5.27.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
The ArgumentReader class internally encapsulates the process of reading command line arguments. More...
#include <argumentparserprivate.h>
Public Member Functions | |
ArgumentReader (ArgumentParser &parser, const char *const *argv, const char *const *end, bool completionMode=false) | |
Initializes the internal reader for the specified parser and arguments. | |
ArgumentReader & | reset (const char *const *argv, const char *const *end) |
Resets the ArgumentReader to continue reading new argv. | |
bool | read () |
Reads the commands line arguments specified when constructing the object. | |
bool | read (ArgumentVector &args) |
Reads the commands line arguments specified when constructing the object. | |
Public Attributes | |
ArgumentParser & | parser |
The associated ArgumentParser instance. | |
ArgumentVector & | args |
The Argument instances to store the results. Sub arguments of args are considered as well. | |
std::size_t | index |
An index which is incremented when an argument is encountered (the current index is stored in the occurrence) or a value is encountered. | |
const char *const * | argv |
Points to the first argument denotation and will be incremented when a denotation has been processed. | |
const char *const * | end |
Points to the end of the argv array. | |
Argument * | lastArg |
The last Argument instance which could be detected. Set to nullptr in the initial call. Used for Bash completion. | |
const char *const * | lastArgDenotation |
Points to the element in argv where lastArg was encountered. Unspecified if lastArg is not set. | |
const char * | argDenotation |
The currently processed abbreviation denotation (should be substring of one of the args in argv). Set to nullptr for processing argv from the beginning (default). | |
unsigned char | argDenotationType |
The type of the currently processed abbreviation denotation. Unspecified if argDenotation is not set. | |
bool | completionMode |
Whether completion mode is enabled. In this case reading args will be continued even if an denotation is unknown (regardless of unknownArgumentBehavior()). | |
The ArgumentReader class internally encapsulates the process of reading command line arguments.
Definition at line 9 of file argumentparserprivate.h.
CppUtilities::ArgumentReader::ArgumentReader | ( | ArgumentParser & | parser, |
const char *const * | argv, | ||
const char *const * | end, | ||
bool | completionMode = false ) |
Initializes the internal reader for the specified parser and arguments.
Definition at line 126 of file argumentparser.cpp.
bool CppUtilities::ArgumentReader::read | ( | ) |
Reads the commands line arguments specified when constructing the object.
Definition at line 155 of file argumentparser.cpp.
bool CppUtilities::ArgumentReader::read | ( | ArgumentVector & | args | ) |
Reads the commands line arguments specified when constructing the object.
Definition at line 175 of file argumentparser.cpp.
ArgumentReader & CppUtilities::ArgumentReader::reset | ( | const char *const * | argv, |
const char *const * | end ) |
Resets the ArgumentReader to continue reading new argv.
Definition at line 141 of file argumentparser.cpp.
const char* CppUtilities::ArgumentReader::argDenotation |
The currently processed abbreviation denotation (should be substring of one of the args in argv). Set to nullptr for processing argv from the beginning (default).
Definition at line 31 of file argumentparserprivate.h.
unsigned char CppUtilities::ArgumentReader::argDenotationType |
The type of the currently processed abbreviation denotation. Unspecified if argDenotation is not set.
Definition at line 33 of file argumentparserprivate.h.
ArgumentVector& CppUtilities::ArgumentReader::args |
The Argument instances to store the results. Sub arguments of args are considered as well.
Definition at line 19 of file argumentparserprivate.h.
const char* const* CppUtilities::ArgumentReader::argv |
Points to the first argument denotation and will be incremented when a denotation has been processed.
Definition at line 23 of file argumentparserprivate.h.
bool CppUtilities::ArgumentReader::completionMode |
Whether completion mode is enabled. In this case reading args will be continued even if an denotation is unknown (regardless of unknownArgumentBehavior()).
Definition at line 35 of file argumentparserprivate.h.
const char* const* CppUtilities::ArgumentReader::end |
Points to the end of the argv array.
Definition at line 25 of file argumentparserprivate.h.
std::size_t CppUtilities::ArgumentReader::index |
An index which is incremented when an argument is encountered (the current index is stored in the occurrence) or a value is encountered.
Definition at line 21 of file argumentparserprivate.h.
Argument* CppUtilities::ArgumentReader::lastArg |
The last Argument instance which could be detected. Set to nullptr in the initial call. Used for Bash completion.
Definition at line 27 of file argumentparserprivate.h.
const char* const* CppUtilities::ArgumentReader::lastArgDenotation |
Points to the element in argv where lastArg was encountered. Unspecified if lastArg is not set.
Definition at line 29 of file argumentparserprivate.h.
ArgumentParser& CppUtilities::ArgumentReader::parser |
The associated ArgumentParser instance.
Definition at line 17 of file argumentparserprivate.h.