3 #include "ArgumentList.h"
8 void ArgumentList::from_string(std::string string
) {
9 /* TODO: support quoted arguments . . . */
10 while(string
.length()) {
11 std::string argument
= string
.substr(0, string
.find(" "));
12 if(string
.find(" ") != std::string::npos
) string
.erase(0, string
.find(" ")+1);
14 add_argument(argument
);
18 char **ArgumentList::get_as_argv() {
21 arguments
= new char *[argument_vector
.size()+1];
23 for(std::size_t x
= 0; x
< argument_vector
.size(); x
++) {
24 arguments
[x
] = new char[std::strlen(argument_vector
[x
].c_str()) + 1];
25 std::strcpy(arguments
[x
], argument_vector
[x
].c_str());
27 arguments
[argument_vector
.size()] = 0;
33 } // namespace Aesalon