diff options
Diffstat (limited to 'native/dicttoolkit/src/utils/arguments_and_options.h')
-rw-r--r-- | native/dicttoolkit/src/utils/arguments_and_options.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/native/dicttoolkit/src/utils/arguments_and_options.h b/native/dicttoolkit/src/utils/arguments_and_options.h index d8f5985e5..2d81b1ecb 100644 --- a/native/dicttoolkit/src/utils/arguments_and_options.h +++ b/native/dicttoolkit/src/utils/arguments_and_options.h @@ -42,6 +42,29 @@ class ArgumentsAndOptions { return mOptions.find(optionName) != mOptions.end(); } + const std::string &getOptionValue(const std::string &optionName) const { + const auto &it = mOptions.find(optionName); + ASSERT(it != mOptions.end()); + return it->second; + } + + bool hasArgument(const std::string &name) const { + const auto &it = mArguments.find(name); + return it != mArguments.end() && !it->second.empty(); + } + + const std::string &getSingleArgument(const std::string &name) const { + const auto &it = mArguments.find(name); + ASSERT(it != mArguments.end() && !it->second.empty()); + return it->second.front(); + } + + const std::vector<std::string> &getVariableLengthArguments(const std::string &name) const { + const auto &it = mArguments.find(name); + ASSERT(it != mArguments.end()); + return it->second; + } + private: DISALLOW_ASSIGNMENT_OPERATOR(ArgumentsAndOptions); |