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