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