equal
deleted
inserted
replaced
23 #include "Configuration.h" |
23 #include "Configuration.h" |
24 |
24 |
25 class CLIParser { |
25 class CLIParser { |
26 private: |
26 private: |
27 |
27 |
28 static const std::string OPTION_TEXTURE; |
28 static const std::string OPTION_DOCUMENT; |
29 static const std::string OPTION_SHADER; |
29 static const std::string OPTION_SHADER; |
30 static const std::string OPTION_BACKGROUND_COLOR; |
30 static const std::string OPTION_BACKGROUND_COLOR; |
31 static const std::string OPTION_ROOT_WINDOW; |
31 static const std::string OPTION_ROOT_WINDOW; |
32 |
32 |
33 const std::string |
33 const std::string |
67 Configuration c; |
67 Configuration c; |
68 |
68 |
69 for (int i = 0; i < arguments.size();) { |
69 for (int i = 0; i < arguments.size();) { |
70 const std::string& option = readNext(arguments, i); |
70 const std::string& option = readNext(arguments, i); |
71 |
71 |
72 if (option == OPTION_TEXTURE) { |
72 if (option == OPTION_DOCUMENT) { |
73 Configuration::Texture tex; |
73 Configuration::Document document; |
74 tex.fileName = readNext(arguments, i); |
74 document.fileName = readNext(arguments, i); |
75 c.textures.push_back(tex); |
75 c.documents.push_back(document); |
76 } else if (option == OPTION_SHADER) { |
76 } else if (option == OPTION_SHADER) { |
77 const auto type = readNext(arguments, i); |
77 const auto type = readNext(arguments, i); |
78 const auto file = readNext(arguments, i); |
78 const auto file = readNext(arguments, i); |
79 c.shaders.push_back({file, type}); |
79 c.shaders.push_back({file, type}); |
80 } else if (option == OPTION_BACKGROUND_COLOR) { |
80 } else if (option == OPTION_BACKGROUND_COLOR) { |
86 |
86 |
87 return c; |
87 return c; |
88 } |
88 } |
89 }; |
89 }; |
90 |
90 |
91 const std::string CLIParser::OPTION_TEXTURE = "--texture"; |
91 const std::string CLIParser::OPTION_DOCUMENT = "--document"; |
92 const std::string CLIParser::OPTION_SHADER = "--shader"; |
92 const std::string CLIParser::OPTION_SHADER = "--shader"; |
93 const std::string CLIParser::OPTION_BACKGROUND_COLOR = "--background-color"; |
93 const std::string CLIParser::OPTION_BACKGROUND_COLOR = "--background-color"; |
94 const std::string CLIParser::OPTION_ROOT_WINDOW = "--root-window"; |
94 const std::string CLIParser::OPTION_ROOT_WINDOW = "--root-window"; |