| 120 | |
| 121 | |
| 122 | bool OptionProcessor::processCommon(const std::string& optionStr, bool isShort, std::string& optionName, std::string& optionArg) |
| 123 | { |
| 124 | if (!_deferredOption.empty()) |
| 125 | { |
| 126 | const Option& option = _options.getOption(_deferredOption, false); |
| 127 | std::string optionWithArg(_deferredOption); |
| 128 | _deferredOption.clear(); |
| 129 | optionWithArg += '='; |
| 130 | optionWithArg += optionStr; |
| 131 | option.process(optionWithArg, optionArg); |
| 132 | optionName = option.fullName(); |
| 133 | return true; |
| 134 | } |
| 135 | if (optionStr.empty()) throw EmptyOptionException(); |
| 136 | const Option& option = _options.getOption(optionStr, isShort); |
| 137 | const std::string& group = option.group(); |
| 138 | if (!group.empty()) |
| 139 | { |
| 140 | if (_groups.find(group) != _groups.end()) |
| 141 | throw IncompatibleOptionsException(option.fullName()); |
| 142 | else |
| 143 | _groups.insert(group); |
| 144 | } |
| 145 | if (_specifiedOptions.find(option.fullName()) != _specifiedOptions.end() && !option.repeatable()) |
| 146 | throw DuplicateOptionException(option.fullName()); |
| 147 | _specifiedOptions.insert(option.fullName()); |
| 148 | if (option.argumentRequired() && ((!isShort && optionStr.find_first_of(":=") == std::string::npos) || (isShort && optionStr.length() == option.shortName().length()))) |
| 149 | { |
| 150 | _deferredOption = option.fullName(); |
| 151 | return true; |
| 152 | } |
| 153 | option.process(optionStr, optionArg); |
| 154 | optionName = option.fullName(); |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | } } // namespace Poco::Util |
nothing calls this directly
no test coverage detected