src/CLIParser.h
branchv_0
changeset 28 9172bd97ae99
parent 27 532953173cd5
child 29 6f15f18d2abf
equal deleted inserted replaced
27:532953173cd5 28:9172bd97ae99
    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_HASH;
    54 	static const string_t OPTION_HASH;
       
    55 	static const string_t OPTION_SCRIPT;
    55 	static const string_t OPTION_AS;
    56 	static const string_t OPTION_AS;
    56 	static const string_t OPTION_OPTION;
    57 	static const string_t OPTION_OPTION;
    57 	static const string_t OPTION_RELATION;
    58 	static const string_t OPTION_RELATION;
    58 
    59 
    59 	Configuration parse(const std::vector<string_t>& arguments) {
    60 	Configuration parse(const std::vector<string_t>& arguments) {
    66 			std::vector<string_t> currentOptions;
    67 			std::vector<string_t> currentOptions;
    67 
    68 
    68 			for (int i = 0; i < arguments.size();) {
    69 			for (int i = 0; i < arguments.size();) {
    69 				string_t option = readNext(arguments, i);
    70 				string_t option = readNext(arguments, i);
    70 
    71 
    71 				if (option == CLIParser::OPTION_FILE || option == CLIParser::OPTION_XATTR || option == CLIParser::OPTION_HASH) {
    72 				if (option == CLIParser::OPTION_FILE || option == CLIParser::OPTION_XATTR || option == CLIParser::OPTION_HASH || option == CLIParser::OPTION_SCRIPT) {
    72 					addField(c, currentGroup, currentName, currentAliases, currentOptions); // previous field
    73 					addField(c, currentGroup, currentName, currentAliases, currentOptions); // previous field
    73 					currentGroup = option.substr(2); // cut off --
    74 					currentGroup = option.substr(2); // cut off --
    74 					currentName = readNext(arguments, i);
    75 					currentName = readNext(arguments, i);
    75 				} else if (option == OPTION_AS) {
    76 				} else if (option == OPTION_AS) {
    76 					currentAliases.push_back(readNext(arguments, i));
    77 					currentAliases.push_back(readNext(arguments, i));
   112 };
   113 };
   113 
   114 
   114 const string_t CLIParser::OPTION_FILE = L"--" + RequestedField::GROUP_FILE;
   115 const string_t CLIParser::OPTION_FILE = L"--" + RequestedField::GROUP_FILE;
   115 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR;
   116 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR;
   116 const string_t CLIParser::OPTION_HASH = L"--" + RequestedField::GROUP_HASH;
   117 const string_t CLIParser::OPTION_HASH = L"--" + RequestedField::GROUP_HASH;
       
   118 const string_t CLIParser::OPTION_SCRIPT = L"--" + RequestedField::GROUP_SCRIPT;
   117 const string_t CLIParser::OPTION_AS = L"--as";
   119 const string_t CLIParser::OPTION_AS = L"--as";
   118 const string_t CLIParser::OPTION_OPTION = L"--option";
   120 const string_t CLIParser::OPTION_OPTION = L"--option";
   119 const string_t CLIParser::OPTION_RELATION = L"--relation";
   121 const string_t CLIParser::OPTION_RELATION = L"--relation";
   120 
   122 
   121 }
   123 }