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_EXEC; |
55 static const string_t OPTION_SCRIPT; |
|
56 static const string_t OPTION_AS; |
55 static const string_t OPTION_AS; |
57 static const string_t OPTION_OPTION; |
56 static const string_t OPTION_OPTION; |
58 static const string_t OPTION_RELATION; |
57 static const string_t OPTION_RELATION; |
59 |
58 |
60 Configuration parse(const std::vector<string_t>& arguments) { |
59 Configuration parse(const std::vector<string_t>& arguments) { |
67 std::vector<string_t> currentOptions; |
66 std::vector<string_t> currentOptions; |
68 |
67 |
69 for (int i = 0; i < arguments.size();) { |
68 for (int i = 0; i < arguments.size();) { |
70 string_t option = readNext(arguments, i); |
69 string_t option = readNext(arguments, i); |
71 |
70 |
72 if (option == CLIParser::OPTION_FILE || option == CLIParser::OPTION_XATTR || option == CLIParser::OPTION_HASH || option == CLIParser::OPTION_SCRIPT) { |
71 if (option == CLIParser::OPTION_FILE || option == CLIParser::OPTION_XATTR || option == CLIParser::OPTION_EXEC) { |
73 addField(c, currentGroup, currentName, currentAliases, currentOptions); // previous field |
72 addField(c, currentGroup, currentName, currentAliases, currentOptions); // previous field |
74 currentGroup = option.substr(2); // cut off -- |
73 currentGroup = option.substr(2); // cut off -- |
75 currentName = readNext(arguments, i); |
74 currentName = readNext(arguments, i); |
76 } else if (option == OPTION_AS) { |
75 } else if (option == OPTION_AS) { |
77 currentAliases.push_back(readNext(arguments, i)); |
76 currentAliases.push_back(readNext(arguments, i)); |
103 c.fields.push_back(RequestedField(RequestedField::GROUP_FILE, FileAttributeFinder::FIELD_OWNER)); |
102 c.fields.push_back(RequestedField(RequestedField::GROUP_FILE, FileAttributeFinder::FIELD_OWNER)); |
104 c.fields.push_back(RequestedField(RequestedField::GROUP_FILE, FileAttributeFinder::FIELD_GROUP)); |
103 c.fields.push_back(RequestedField(RequestedField::GROUP_FILE, FileAttributeFinder::FIELD_GROUP)); |
105 // c.fields.push_back(RequestedField(RequestedField::GROUP_XATTR, L"user.xdg.origin.url")); |
104 // c.fields.push_back(RequestedField(RequestedField::GROUP_XATTR, L"user.xdg.origin.url")); |
106 } |
105 } |
107 |
106 |
|
107 for (int i = 0; i < c.fields.size(); i++) c.fields[i].id = i; |
|
108 |
108 return c; |
109 return c; |
109 } |
110 } |
110 |
111 |
111 virtual ~CLIParser() { |
112 virtual ~CLIParser() { |
112 } |
113 } |
113 }; |
114 }; |
114 |
115 |
115 const string_t CLIParser::OPTION_FILE = L"--" + RequestedField::GROUP_FILE; |
116 const string_t CLIParser::OPTION_FILE = L"--" + RequestedField::GROUP_FILE; |
116 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR; |
117 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR; |
117 const string_t CLIParser::OPTION_HASH = L"--" + RequestedField::GROUP_HASH; |
118 const string_t CLIParser::OPTION_EXEC = L"--" + RequestedField::GROUP_EXEC; |
118 const string_t CLIParser::OPTION_SCRIPT = L"--" + RequestedField::GROUP_SCRIPT; |
|
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 } |