MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / process

Method process

base/poco/Util/src/Option.cpp:253–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252
253void Option::process(const std::string& option, std::string& arg) const
254{
255 std::string::size_type pos = option.find_first_of(":=");
256 std::string::size_type len = pos == std::string::npos ? option.length() : pos;
257 if (icompare(option, 0, len, _fullName, 0, len) == 0)
258 {
259 if (takesArgument())
260 {
261 if (argumentRequired() && pos == std::string::npos)
262 throw MissingArgumentException(_fullName + " requires " + argumentName());
263 if (pos != std::string::npos)
264 arg.assign(option, pos + 1, option.length() - pos - 1);
265 else
266 arg.clear();
267 }
268 else if (pos != std::string::npos)
269 {
270 throw UnexpectedArgumentException(option);
271 }
272 else arg.clear();
273 }
274 else if (!_shortName.empty() && option.compare(0, _shortName.length(), _shortName) == 0)
275 {
276 if (takesArgument())
277 {
278 if (argumentRequired() && option.length() == _shortName.length())
279 throw MissingArgumentException(_shortName + " requires " + argumentName());
280 arg.assign(option, _shortName.length(), option.length() - _shortName.length());
281 }
282 else if (option.length() != _shortName.length())
283 {
284 throw UnexpectedArgumentException(option);
285 }
286 else arg.clear();
287 }
288 else throw UnknownOptionException(option);
289}
290
291
292} } // namespace Poco::Util

Callers 1

processPocoOptionsMethod · 0.45

Calls 6

icompareFunction · 0.50
lengthMethod · 0.45
assignMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected