EpcTools
An event based multi-threaded C++ development framework.
|
Go to the documentation of this file.
18 #ifndef __egetopt_h_included
19 #define __egetopt_h_included
125 LongLong
getCmdLine(cpStr path, LongLong def)
const;
131 ULong
getCmdLine(cpStr path, ULong def)
const;
137 ULongLong
getCmdLine(cpStr path, ULongLong def)
const;
143 Double
getCmdLine(cpStr path, Double def)
const;
149 cpStr
getCmdLine(cpStr path, cpStr def)
const;
168 Long
get(cpStr path, Long def)
const;
174 LongLong
get(cpStr path, LongLong def)
const;
180 ULong
get(cpStr path, ULong def)
const;
186 ULongLong
get(cpStr path, ULongLong def)
const;
192 Double
get(cpStr path, Double def)
const;
198 cpStr
get(cpStr path, cpStr def)
const;
204 Bool
get(cpStr path, Bool def)
const;
219 T
get(UInt idx, cpStr path, cpStr member, T def)
const
222 mbr.
format(
"%u/%s", idx, member);
223 EString pth = combinePath(path, mbr.c_str());
224 return get(pth, def);
231 EString combinePath(cpStr path1, cpStr path2)
const;
232 const Option *findOption(cpStr name,
const Option *options);
242 class EGetOptError_MissingRequiredArgument :
public EError
245 EGetOptError_MissingRequiredArgument(cpStr pszFile);
246 virtual const cpStr
Name()
const {
return "EGetOptError_MissingRequiredArgument"; }
249 class EGetOptError_UnsupportedArgType :
public EError
253 virtual const cpStr
Name()
const {
return "EGetOptError_UnsupportedArgType"; }
256 class EGetOptError_UnsupportedDataType :
public EError
260 virtual const cpStr
Name()
const {
return "EGetOptError_UnsupportedDataType"; }
263 class EGetOptError_UnsupportedBooleanValue :
public EError
266 EGetOptError_UnsupportedBooleanValue(cpStr val);
267 virtual const cpStr
Name()
const {
return "EGetOptError_UnsupportedBooleanValue"; }
270 class EGetOptError_FileParsing :
public EError
273 EGetOptError_FileParsing(cpStr val);
274 virtual const cpStr
Name()
const {
return "EGetOptError_FileParsing"; }
278 #endif // #define __egetopt_h_included
string
Definition: egetopt.h:51
8-byte floating point number
Definition: egetopt.h:61
UInt getCount(cpStr path) const
returns the number of configuration entries specified in a JSON array.
Definition: egetopt.cpp:577
ArgType argType
indicates if an argument is required or not
Definition: egetopt.h:74
Defines base class for exceptions and declaration helper macros.
Long getCmdLine(cpStr path, Long def) const
Returns the value of the specified command line argument as a 32-bit integer.
Definition: egetopt.cpp:302
DataType dataType
the data type of the argument
Definition: egetopt.h:76
ArgType
Indicates if an argument associated with a command line argument is required.
Definition: egetopt.h:35
no argument required
Definition: egetopt.h:38
EString longName
the long name of the argument e.g.: –argument
Definition: egetopt.h:72
Void setPrefix(cpStr path)
Sets the search prefix.
Definition: egetopt.h:93
an argument is required
Definition: egetopt.h:40
Describes the defined command line arguments.
Definition: egetopt.h:67
32-bit unsigned integer
Definition: egetopt.h:57
32-bit integer
Definition: egetopt.h:53
EGetOpt()
Class constructor.
Definition: egetopt.cpp:260
virtual const cpStr Name() const
Returns the name of this object.
Definition: eerror.h:189
Void loadCmdLine(Int argc, pStr *argv, const EGetOpt::Option *options)
Parses and loads the command line arguments.
Definition: egetopt.cpp:613
boolean
Definition: egetopt.h:63
Long get(cpStr path, Long def) const
Returns the value of the specified configuration value as a 32-bit integer.
Definition: egetopt.cpp:455
EString shortName
the short name of the argument e.g.: -a
Definition: egetopt.h:70
Void print() const
Prints the current loaded values (command line and file).
Definition: egetopt.cpp:297
Void setPrefix(const EString &path)
Sets the search prefix.
Definition: egetopt.h:88
~EGetOpt()
Class destructor.
Definition: egetopt.cpp:284
the argument is optional *** NOT IMPLEMENTED ***
Definition: egetopt.h:42
std::vector< EString > getCmdLineArgs() const
Returns a std::vector containing positional command line arguments.
Definition: egetopt.cpp:415
T get(UInt idx, cpStr path, cpStr member, T def) const
Returns the value associated with an array.
Definition: egetopt.h:219
64-bit unsigned integer
Definition: egetopt.h:59
EString & format(cpChar pszFormat,...)
Sets the value to the string using a "printf" style format string and arguments.
Definition: estring.cpp:38
String class.
Definition: estring.h:30
DataType
The data type of the command line argument.
Definition: egetopt.h:46
Void loadFile(cpStr filename)
Parses and loads configuration values from the specified JSON file.
Definition: egetopt.cpp:748
no argument
Definition: egetopt.h:49
The base class for exceptions derived from std::exception.
Definition: eerror.h:92
64-bit integer
Definition: egetopt.h:55
Encapsulates and extends a std::string object.
std::vector< EString > getCmdLineRaw() const
Returns a std::vector containing the "raw" string command line arguments.
Definition: egetopt.cpp:435