 |
Shiokaze Framework
A research-oriented fluid solver for computer graphics
|
|
Go to the documentation of this file.
25 #ifndef SHKZ_CMDPARSER_H
26 #define SHKZ_CMDPARSER_H
69 cmdparser( std::map<std::string,std::string> dictionary ) {
78 void parse( std::map<std::string,std::string> dictionary ) {
79 for(
auto it=dictionary.begin(); it!=dictionary.end(); ++it ) {
92 void parse (
int argc,
const char * argv[] ) {
93 for(
unsigned i=0; i<argc; i++ ) {
94 std::string str(argv[i]);
95 for(
unsigned k=0; k<str.size(); k++ ) {
96 if( str.at(k) ==
'=' ) {
97 std::string name(str.begin(),str.begin()+k);
98 std::string value(str.begin()+k+1,str.end());
99 value.erase(std::remove(value.begin(), value.end(),
'\\'), value.end());
104 if( i != argc-1 ) m_arg_str +=
" ";
113 m_arg_str = std::string();
115 for(
auto it=dictionary.crbegin(); it!=dictionary.crend(); ++it ) {
116 m_arg_str += it->first +
"=" + it->second +
" ";
130 std::string m_arg_str;
cmdparser(int argc, const char *argv[])
Constructor for cmdparser.
Definition: cmdparser.h:51
Class that parses command line arguments.
Definition: cmdparser.h:36
cmdparser(std::map< std::string, std::string > dictionary)
Constructor for cmdparser.
Definition: cmdparser.h:69
void rebuild_arg_str()
Parse dictionary and set arguments.
Definition: cmdparser.h:112
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
std::string get_arg_string() const
Get the organized string of arguments.
Definition: cmdparser.h:125
void parse(int argc, const char *argv[])
Analyze arguments and set from the arguments called from main function.
Definition: cmdparser.h:92
void parse(std::map< std::string, std::string > dictionary)
Parse dictionary and set arguments.
Definition: cmdparser.h:78
Class that controls the settings of the program.
Definition: configuration.h:39
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
cmdparser(const cmdparser &parser)
Copy constructor for cmdparser.
Definition: cmdparser.h:60
cmdparser()
Default constructor.
Definition: cmdparser.h:42
void set_string(std::string name, std::string value)
Set string parameter.
const std::map< std::string, std::string > & get_dictionary() const
Get the dictionary of parameter.
Definition: configuration.h:540