working on the structure
This commit is contained in:
parent
cf03f083c0
commit
30b04c079e
|
@ -23,10 +23,11 @@ private:
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
bool set;
|
bool set;
|
||||||
// lists
|
// lists for attributes of an option
|
||||||
std::unique_ptr<std::list<std::string>> options;
|
std::unique_ptr<std::list<std::string>> options;
|
||||||
std::unique_ptr<std::list<std::string>> possibleParameters;
|
std::unique_ptr<std::list<std::string>> possibleParameters;
|
||||||
std::unique_ptr<std::list<std::string>> defaultParameters;
|
std::unique_ptr<std::list<std::string>> defaultParameters;
|
||||||
|
// values, this list can only be filled by parsing the input data
|
||||||
std::unique_ptr<std::list<std::string>> values;
|
std::unique_ptr<std::list<std::string>> values;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -34,8 +35,20 @@ public:
|
||||||
Option(std::string name);
|
Option(std::string name);
|
||||||
virtual ~Option();
|
virtual ~Option();
|
||||||
|
|
||||||
void setName(std::string name);
|
// Methods setting configuration attributes
|
||||||
|
std::shared_ptr<Option> setName(std::string name);
|
||||||
|
std::shared_ptr<Option> addCommand(std::string cmd);
|
||||||
|
std::shared_ptr<Option> addPossibleParameter(std::string param);
|
||||||
|
std::shared_ptr<Option> addDefaultParameter(std::string param);
|
||||||
|
std::shared_ptr<Option> setStrictChoice(bool strict);
|
||||||
|
|
||||||
|
// Methods for retrieving information in different formats
|
||||||
|
std::shared_ptr<std::list<std::string>> getValues();
|
||||||
|
std::string getValueAsString(uint index);
|
||||||
|
uint getValueCount();
|
||||||
|
int getValueAsInteger(uint index);
|
||||||
|
double getValueAsDouble(uint index);
|
||||||
|
float getValueAsFloat(uint index);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CmdLineOptions {
|
class CmdLineOptions {
|
||||||
|
@ -45,8 +58,13 @@ public:
|
||||||
static std::unique_ptr<CmdLineOptions> i();
|
static std::unique_ptr<CmdLineOptions> i();
|
||||||
std::shared_ptr<Option> create(std::string name);
|
std::shared_ptr<Option> create(std::string name);
|
||||||
std::shared_ptr<Option> getOption(std::string name);
|
std::shared_ptr<Option> getOption(std::string name);
|
||||||
|
void setCommandCharacter(char cmdchar);
|
||||||
|
|
||||||
|
void parse(char** argv, int argc);
|
||||||
|
void parse(std::list<std::string> argv);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
char cmdchar;
|
||||||
CmdLineOptions();
|
CmdLineOptions();
|
||||||
static std::unique_ptr<CmdLineOptions> instance;
|
static std::unique_ptr<CmdLineOptions> instance;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue