src/CLIParser.h
branchv_0
changeset 31 c64e1588f428
parent 29 6f15f18d2abf
child 52 fea625f0a096
equal deleted inserted replaced
30:56409232e1a1 31:c64e1588f428
    49 
    49 
    50 public:
    50 public:
    51 
    51 
    52 	static const string_t OPTION_FILE;
    52 	static const string_t OPTION_FILE;
    53 	static const string_t OPTION_XATTR;
    53 	static const string_t OPTION_XATTR;
    54 	static const string_t OPTION_EXEC;
    54 	static const string_t OPTION_STREAMLET;
    55 	static const string_t OPTION_AS;
    55 	static const string_t OPTION_AS;
    56 	static const string_t OPTION_OPTION;
    56 	static const string_t OPTION_OPTION;
    57 	static const string_t OPTION_RELATION;
    57 	static const string_t OPTION_RELATION;
    58 
    58 
    59 	Configuration parse(const std::vector<string_t>& arguments) {
    59 	Configuration parse(const std::vector<string_t>& arguments) {
    66 			std::vector<string_t> currentOptions;
    66 			std::vector<string_t> currentOptions;
    67 
    67 
    68 			for (int i = 0; i < arguments.size();) {
    68 			for (int i = 0; i < arguments.size();) {
    69 				string_t option = readNext(arguments, i);
    69 				string_t option = readNext(arguments, i);
    70 
    70 
    71 				if (option == CLIParser::OPTION_FILE || option == CLIParser::OPTION_XATTR || option == CLIParser::OPTION_EXEC) {
    71 				if (option == CLIParser::OPTION_FILE || option == CLIParser::OPTION_XATTR || option == CLIParser::OPTION_STREAMLET) {
    72 					addField(c, currentGroup, currentName, currentAliases, currentOptions); // previous field
    72 					addField(c, currentGroup, currentName, currentAliases, currentOptions); // previous field
    73 					currentGroup = option.substr(2); // cut off --
    73 					currentGroup = option.substr(2); // cut off --
    74 					currentName = readNext(arguments, i);
    74 					currentName = readNext(arguments, i);
    75 				} else if (option == OPTION_AS) {
    75 				} else if (option == OPTION_AS) {
    76 					currentAliases.push_back(readNext(arguments, i));
    76 					currentAliases.push_back(readNext(arguments, i));
   113 	}
   113 	}
   114 };
   114 };
   115 
   115 
   116 const string_t CLIParser::OPTION_FILE = L"--" + RequestedField::GROUP_FILE;
   116 const string_t CLIParser::OPTION_FILE = L"--" + RequestedField::GROUP_FILE;
   117 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR;
   117 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR;
   118 const string_t CLIParser::OPTION_EXEC = L"--" + RequestedField::GROUP_EXEC;
   118 const string_t CLIParser::OPTION_STREAMLET = L"--" + RequestedField::GROUP_STREAMLET;
   119 const string_t CLIParser::OPTION_AS = L"--as";
   119 const string_t CLIParser::OPTION_AS = L"--as";
   120 const string_t CLIParser::OPTION_OPTION = L"--option";
   120 const string_t CLIParser::OPTION_OPTION = L"--option";
   121 const string_t CLIParser::OPTION_RELATION = L"--relation";
   121 const string_t CLIParser::OPTION_RELATION = L"--relation";
   122 
   122 
   123 }
   123 }