Began switching the GUI system to use a QSettings object.
[aesalon.git] / src / platform / ArgumentList.cpp
blob1d9a8d6408815b0d26b45ad8f0ed10951a0044d9
1 #include <cstring>
2 #include <iostream>
3 #include "ArgumentList.h"
5 namespace Aesalon {
6 namespace Platform {
8 void ArgumentList::from_string(std::string string) {
9 /* TODO: support quoted arguments . . . */
10 while(string.length()) {
11 std::cout << "ArgumentList::from_string(): string is \"" << string << "\"\n";
12 std::string argument = string.substr(0, string.find(" "));
13 if(string.find(" ") != std::string::npos) string.erase(0, string.find(" ")+1);
14 else return;
15 add_argument(argument);
19 char **ArgumentList::get_as_argv() {
20 char **arguments;
22 arguments = new char *[argument_vector.size()+1];
24 for(std::size_t x = 0; x < argument_vector.size(); x ++) {
25 arguments[x] = new char[std::strlen(argument_vector[x].c_str()) + 1];
26 std::strcpy(arguments[x], argument_vector[x].c_str());
28 arguments[argument_vector.size()] = 0;
30 return arguments;
33 } // namespace Platform
34 } // namespace Aesalon