2020#include < string>
2121#include < vector>
2222
23- using namespace std ;
24-
2523namespace sda {
2624namespace utils {
2725
@@ -37,31 +35,13 @@ bool is_file(const std::string &name);
3735class CmdLineParser {
3836public:
3937 class CmdSwitch {
40- public:
41- CmdSwitch () {}
42- CmdSwitch (const CmdSwitch &rhs) { copyfrom (rhs); }
43-
44- void copyfrom (const CmdSwitch &rhs) {
45- this ->key = rhs.key ;
46- this ->shortcut = rhs.shortcut ;
47- this ->default_value = rhs.default_value ;
48- this ->value = rhs.value ;
49- this ->desc = rhs.desc ;
50- this ->istoggle = rhs.istoggle ;
51- this ->isvalid = rhs.isvalid ;
52- }
53-
54- CmdSwitch &operator =(const CmdSwitch &rhs) {
55- this ->copyfrom (rhs);
56- return *this ;
57- }
5838
5939 public:
60- string key;
61- string shortcut;
62- string default_value;
63- string value;
64- string desc;
40+ std:: string key;
41+ std:: string shortcut;
42+ std:: string default_value;
43+ std:: string value;
44+ std:: string desc;
6545 bool istoggle;
6646 bool isvalid;
6747 };
@@ -72,8 +52,9 @@ class CmdLineParser {
7252 virtual ~CmdLineParser ();
7353
7454 bool addSwitch (const CmdSwitch &s);
75- bool addSwitch (const string &name, const string &shortcut, const string &desc,
76- const string &default_value = " " , bool istoggle = false );
55+ bool addSwitch (const std::string &name, const std::string &shortcut,
56+ const std::string &desc, const std::string &default_value = " " ,
57+ bool istoggle = false );
7758
7859 /* !
7960 * sets default key to be able to read a 2 argumented call
@@ -88,7 +69,7 @@ class CmdLineParser {
8869 /* !
8970 * retrieve value using a key
9071 */
91- string value (const char *key);
72+ std:: string value (const char *key);
9273
9374 int value_to_int (const char *key);
9475
@@ -110,14 +91,14 @@ class CmdLineParser {
11091 */
11192 CmdSwitch *getCmdSwitch (const char *key);
11293
113- bool token_to_fullkeyname (const string &token, string &fullkey);
94+ bool token_to_fullkeyname (const std:: string &token, std:: string &fullkey);
11495
11596private:
116- map<string, CmdSwitch *> m_mapKeySwitch;
117- map<string, string> m_mapShortcutKeys;
118- vector<CmdSwitch *> m_vSwitches;
119- string m_strDefaultKey;
120- string m_appname;
97+ std:: map<std:: string, CmdSwitch *> m_mapKeySwitch;
98+ std:: map<std:: string, std:: string> m_mapShortcutKeys;
99+ std:: vector<CmdSwitch *> m_vSwitches;
100+ std:: string m_strDefaultKey;
101+ std:: string m_appname;
121102};
122103
123104// bool starts_with(const string& src, const string& sub);
0 commit comments