| 125 | } |
| 126 | |
| 127 | bool CommandLineArguments::GetMatchedArguments( |
| 128 | std::vector<std::string>* matches, std::string const& arg) |
| 129 | { |
| 130 | matches->clear(); |
| 131 | CommandLineArguments::Internal::CallbacksMap::iterator it; |
| 132 | |
| 133 | // Does the argument match to any we know about? |
| 134 | for (it = this->Internals->Callbacks.begin(); |
| 135 | it != this->Internals->Callbacks.end(); ++it) { |
| 136 | CommandLineArguments::Internal::String const& parg = it->first; |
| 137 | CommandLineArgumentsCallbackStructure* cs = &it->second; |
| 138 | if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT || |
| 139 | cs->ArgumentType == CommandLineArguments::SPACE_ARGUMENT) { |
| 140 | if (arg == parg) { |
| 141 | matches->push_back(parg); |
| 142 | } |
| 143 | } else if (arg.find(parg) == 0) { |
| 144 | matches->push_back(parg); |
| 145 | } |
| 146 | } |
| 147 | return !matches->empty(); |
| 148 | } |
| 149 | |
| 150 | int CommandLineArguments::Parse() |
| 151 | { |