EpcTools
An event based multi-threaded C++ development framework.
|
#include <egetopt.h>
Classes | |
struct | Option |
Describes the defined command line arguments. More... | |
Public Types | |
enum | ArgType { no_argument, required_argument, optional_argument } |
Indicates if an argument associated with a command line argument is required. More... | |
enum | DataType { dtNone, dtString, dtInt32, dtInt64, dtUInt32, dtUInt64, dtDouble, dtBool } |
The data type of the command line argument. More... | |
Public Member Functions | |
EGetOpt () | |
Class constructor. More... | |
~EGetOpt () | |
Class destructor. More... | |
Void | setPrefix (const EString &path) |
Sets the search prefix. More... | |
Void | setPrefix (cpStr path) |
Sets the search prefix. More... | |
Void | loadCmdLine (Int argc, pStr *argv, const EGetOpt::Option *options) |
Parses and loads the command line arguments. More... | |
Void | loadFile (cpStr filename) |
Parses and loads configuration values from the specified JSON file. More... | |
Long | getCmdLine (cpStr path, Long def) const |
Returns the value of the specified command line argument as a 32-bit integer. More... | |
LongLong | getCmdLine (cpStr path, LongLong def) const |
Returns the value of the specified command line argument as a 64-bit integer. More... | |
ULong | getCmdLine (cpStr path, ULong def) const |
Returns the value of the specified command line argument as an unsigned 32-bit integer. More... | |
ULongLong | getCmdLine (cpStr path, ULongLong def) const |
Returns the value of the specified command line argument as an unsigned 64-bit integer. More... | |
Double | getCmdLine (cpStr path, Double def) const |
Returns the value of the specified command line argument as a double (8-byte floating point). More... | |
cpStr | getCmdLine (cpStr path, cpStr def) const |
Returns the value of the specified command line argument as a string. More... | |
Bool | getCmdLine (cpStr path, Bool def) const |
Returns the value of the specified command line argument as a boolean. More... | |
std::vector< EString > | getCmdLineArgs () const |
Returns a std::vector containing positional command line arguments. More... | |
std::vector< EString > | getCmdLineRaw () const |
Returns a std::vector containing the "raw" string command line arguments. More... | |
Long | get (cpStr path, Long def) const |
Returns the value of the specified configuration value as a 32-bit integer. More... | |
LongLong | get (cpStr path, LongLong def) const |
Returns the value of the specified configuration value as a 64-bit integer. More... | |
ULong | get (cpStr path, ULong def) const |
Returns the value of the specified configuration value as an unsigned 32-bit integer. More... | |
ULongLong | get (cpStr path, ULongLong def) const |
Returns the value of the specified configuration value as a unsigned 64-bit integer. More... | |
Double | get (cpStr path, Double def) const |
Returns the value of the specified configuration value as a double (8-byte floating point). More... | |
cpStr | get (cpStr path, cpStr def) const |
Returns the value of the specified configuration value as a string. More... | |
Bool | get (cpStr path, Bool def) const |
Returns the value of the specified configuration value as a boolean. More... | |
UInt | getCount (cpStr path) const |
returns the number of configuration entries specified in a JSON array. More... | |
template<typename T > | |
T | get (UInt idx, cpStr path, cpStr member, T def) const |
Returns the value associated with an array. More... | |
Void | print () const |
Prints the current loaded values (command line and file). More... | |
enum EGetOpt::ArgType |
enum EGetOpt::DataType |
EGetOpt::EGetOpt | ( | ) |
Class constructor.
EGetOpt::~EGetOpt | ( | ) |
Class destructor.
Bool EGetOpt::get | ( | cpStr | path, |
Bool | def | ||
) | const |
Returns the value of the specified configuration value as a boolean.
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
cpStr EGetOpt::get | ( | cpStr | path, |
cpStr | def | ||
) | const |
Returns the value of the specified configuration value as a string.
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
Double EGetOpt::get | ( | cpStr | path, |
Double | def | ||
) | const |
Returns the value of the specified configuration value as a double (8-byte floating point).
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
Long EGetOpt::get | ( | cpStr | path, |
Long | def | ||
) | const |
Returns the value of the specified configuration value as a 32-bit integer.
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
LongLong EGetOpt::get | ( | cpStr | path, |
LongLong | def | ||
) | const |
Returns the value of the specified configuration value as a 64-bit integer.
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
ULong EGetOpt::get | ( | cpStr | path, |
ULong | def | ||
) | const |
Returns the value of the specified configuration value as an unsigned 32-bit integer.
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
ULongLong EGetOpt::get | ( | cpStr | path, |
ULongLong | def | ||
) | const |
Returns the value of the specified configuration value as a unsigned 64-bit integer.
path | The path of the requested configuration parameter. |
def | The value to return if the requested path is not found. |
|
inline |
Returns the value associated with an array.
idx | The index associated with the parent JSON object. |
path | The path of the parent object of the requested configuration value. |
member | The member name of the requested configurtion value. |
def | The value to return if the requested path/member is not found. |
Bool EGetOpt::getCmdLine | ( | cpStr | path, |
Bool | def | ||
) | const |
Returns the value of the specified command line argument as a boolean.
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
cpStr EGetOpt::getCmdLine | ( | cpStr | path, |
cpStr | def | ||
) | const |
Returns the value of the specified command line argument as a string.
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
Double EGetOpt::getCmdLine | ( | cpStr | path, |
Double | def | ||
) | const |
Returns the value of the specified command line argument as a double (8-byte floating point).
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
Long EGetOpt::getCmdLine | ( | cpStr | path, |
Long | def | ||
) | const |
Returns the value of the specified command line argument as a 32-bit integer.
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
LongLong EGetOpt::getCmdLine | ( | cpStr | path, |
LongLong | def | ||
) | const |
Returns the value of the specified command line argument as a 64-bit integer.
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
ULong EGetOpt::getCmdLine | ( | cpStr | path, |
ULong | def | ||
) | const |
Returns the value of the specified command line argument as an unsigned 32-bit integer.
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
ULongLong EGetOpt::getCmdLine | ( | cpStr | path, |
ULongLong | def | ||
) | const |
Returns the value of the specified command line argument as an unsigned 64-bit integer.
path | The path of the command line argument. |
def | The value to return if the requested path is not found. |
std::vector< EString > EGetOpt::getCmdLineArgs | ( | ) | const |
Returns a std::vector containing positional command line arguments.
std::vector< EString > EGetOpt::getCmdLineRaw | ( | ) | const |
Returns a std::vector containing the "raw" string command line arguments.
UInt EGetOpt::getCount | ( | cpStr | path | ) | const |
returns the number of configuration entries specified in a JSON array.
path | The path of the requested configuration parameter. |
Void EGetOpt::loadCmdLine | ( | Int | argc, |
pStr * | argv, | ||
const EGetOpt::Option * | options | ||
) |
Parses and loads the command line arguments.
argc | The number of command line arguments. |
argv | A pointer to the array of command line string arguments. |
options | The array of supported arguments. |
EGetOptError_UnsupportedDataType | |
EGetOptError_UnsupportedBooleanValue | |
EGetOptError_UnsupportedArgType |
Void EGetOpt::loadFile | ( | cpStr | filename | ) |
Parses and loads configuration values from the specified JSON file.
filename | The name of the JSON file to load. |
EGetOptError_FileParsing |
Void EGetOpt::print | ( | ) | const |
Prints the current loaded values (command line and file).
|
inline |
Sets the search prefix.
path | The prefix path. |
|
inline |
Sets the search prefix.
path | The prefix path. |