working on some methods...
This commit is contained in:
parent
30b04c079e
commit
e4d053e134
|
@ -10,6 +10,32 @@
|
|||
namespace cmdlineoptions {
|
||||
|
||||
CmdLineOptions::~CmdLineOptions() {}
|
||||
|
||||
const std::unique_ptr<CmdLineOptions> &CmdLineOptions::i() {
|
||||
if (!instance) {
|
||||
instance = std::unique_ptr<CmdLineOptions>(new CmdLineOptions());
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
std::shared_ptr<Option> CmdLineOptions::create(std::string &name) {
|
||||
std::shared_ptr<Option> option = std::make_shared<Option>(name);
|
||||
this->options.insert(std::make_pair(name, option));
|
||||
return option;
|
||||
}
|
||||
|
||||
std::shared_ptr<Option> CmdLineOptions::getOption(std::string &name) {
|
||||
return this->options.at(name);
|
||||
}
|
||||
|
||||
void CmdLineOptions::setCommandCharacter(char &cmdchar) {
|
||||
this->cmdchar = cmdchar;
|
||||
}
|
||||
|
||||
void CmdLineOptions::parse(char **argv, int argc) {}
|
||||
|
||||
void CmdLineOptions::parse(std::list<std::string> argv) {}
|
||||
|
||||
CmdLineOptions::CmdLineOptions() {}
|
||||
|
||||
} /* namespace cmdlineoptions */
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
namespace cmdlineoptions {
|
||||
|
||||
|
@ -55,18 +56,19 @@ class CmdLineOptions {
|
|||
|
||||
public:
|
||||
virtual ~CmdLineOptions();
|
||||
static std::unique_ptr<CmdLineOptions> i();
|
||||
std::shared_ptr<Option> create(std::string name);
|
||||
std::shared_ptr<Option> getOption(std::string name);
|
||||
void setCommandCharacter(char cmdchar);
|
||||
static const std::unique_ptr<CmdLineOptions> &i();
|
||||
std::shared_ptr<Option> create(std::string &name);
|
||||
std::shared_ptr<Option> getOption(std::string &name);
|
||||
void setCommandCharacter(char &cmdchar);
|
||||
|
||||
void parse(char** argv, int argc);
|
||||
void parse(char **argv, int argc);
|
||||
void parse(std::list<std::string> argv);
|
||||
|
||||
private:
|
||||
char cmdchar;
|
||||
CmdLineOptions();
|
||||
static std::unique_ptr<CmdLineOptions> instance;
|
||||
std::map<std::string, std::shared_ptr<Option>> options;
|
||||
};
|
||||
|
||||
} /* namespace cmdlineoptions */
|
||||
|
|
Loading…
Reference in New Issue