Library of Assembled Shared Sources
|
the parser itself More...
#include <arg_parser.h>
Public Member Functions | |
ArgParser () | |
Construct a quiet parser. | |
ArgParser (const std::string &iProgramName, const std::string &iVersion="", const std::string &iPositionalArguments="") | |
Construct a not so quiet parser. | |
bool | parse (const std::string &iArguments, TArguments *oPositionals=0) |
parse arguments that come by a string. | |
bool | parse (const TArguments &iArguments, TArguments *oPositionals=0) |
parse arguments | |
bool | parse (int iArgc, char *iArgv[], TArguments *oPositionals=0) |
parse arguments from commandline | |
the parser itself
Definition at line 98 of file arg_parser.h.
lass::io::ArgParser::ArgParser | ( | ) |
Construct a quiet parser.
A quiet parser won't write anything to the output (it will still log though), and it will throw as few exceptions as possible
Definition at line 59 of file arg_parser.cpp.
lass::io::ArgParser::ArgParser | ( | const std::string & | iProgramName, |
const std::string & | iProgramVersion = "", | ||
const std::string & | iPositionalArguments = "" ) |
Construct a not so quiet parser.
On wrong input, it will write info to the standard input and will throw some more exceptions.
Definition at line 72 of file arg_parser.cpp.
bool lass::io::ArgParser::parse | ( | const std::string & | iArguments, |
TArguments * | oPositionals = 0 ) |
parse arguments that come by a string.
break string based on whitespace unless it's surrounded by quotes.
Definition at line 162 of file arg_parser.cpp.
References parse().
bool lass::io::ArgParser::parse | ( | const TArguments & | iArguments, |
TArguments * | oPositionals = 0 ) |
parse arguments
argc/argv
, you shouldn't store the program name as the first argument, since the parser will start with iArguments
[0] . Hence, the parser would see the program name as the first positional if you did so. Definition at line 89 of file arg_parser.cpp.
bool lass::io::ArgParser::parse | ( | int | iArgc, |
char * | iArgv[], | ||
TArguments * | oPositionals = 0 ) |
parse arguments from commandline
iArgv
[0] is the program name and will skipped by the parser. the parser will only take care of iArgv
[1] and the following! Definition at line 146 of file arg_parser.cpp.
References parse().