MCPcopy Create free account
hub / github.com/Kitware/CMake / parseArguments

Function parseArguments

Source/cmSourceGroupCommand.cxx:138–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void parseArguments(std::vector<std::string> const& args,
139 ParsedArguments& parsedArguments)
140{
141 ExpectedOptions const expectedOptions = getExpectedOptions();
142 size_t i = 0;
143
144 // at this point we know that args vector is not empty
145
146 // if first argument is not one of expected options it's source group name
147 if (!isExpectedOption(args[0], expectedOptions)) {
148 // get source group name and go to next argument
149 parsedArguments[kSourceGroupOptionName].push_back(args[0]);
150 ++i;
151 }
152
153 for (; i < args.size();) {
154 // get current option and increment index to go to next argument
155 std::string const& currentOption = args[i++];
156
157 // create current option entry in parsed arguments
158 std::vector<std::string>& currentOptionArguments =
159 parsedArguments[currentOption];
160
161 // collect option arguments while we won't find another expected option
162 while (i < args.size() && !isExpectedOption(args[i], expectedOptions)) {
163 currentOptionArguments.push_back(args[i++]);
164 }
165 }
166}
167
168} // namespace
169

Callers 1

cmSourceGroupCommandFunction · 0.85

Calls 4

getExpectedOptionsFunction · 0.85
isExpectedOptionFunction · 0.85
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…