diff options
author | 2014-11-08 09:52:40 +0900 | |
---|---|---|
committer | 2014-11-15 09:58:19 +0900 | |
commit | 79273b04772824a8c547e1a8d33900040a03264b (patch) | |
tree | fcc6b49f99fdc200ef83e80900f5991eb6795000 /native/dicttoolkit/src/utils/arguments_and_options.h | |
parent | 80c4e0f68a1c7444f3394df8c15f53c420b99792 (diff) | |
download | latinime-79273b04772824a8c547e1a8d33900040a03264b.tar.gz latinime-79273b04772824a8c547e1a8d33900040a03264b.tar.xz latinime-79273b04772824a8c547e1a8d33900040a03264b.zip |
Define arguments for commands in dicttoolkit.
Bug: 10059681
Change-Id: I1ceaeeaa9e2055c357fe969818498de9d6288862
Diffstat (limited to 'native/dicttoolkit/src/utils/arguments_and_options.h')
-rw-r--r-- | native/dicttoolkit/src/utils/arguments_and_options.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/native/dicttoolkit/src/utils/arguments_and_options.h b/native/dicttoolkit/src/utils/arguments_and_options.h new file mode 100644 index 000000000..d8f5985e5 --- /dev/null +++ b/native/dicttoolkit/src/utils/arguments_and_options.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_DICT_TOOLKIT_ARGUMENTS_AND_OPTIONS_H +#define LATINIME_DICT_TOOLKIT_ARGUMENTS_AND_OPTIONS_H + +#include <string> +#include <unordered_map> +#include <vector> + +#include "dict_toolkit_defines.h" + +namespace latinime { +namespace dicttoolkit { + +class ArgumentsAndOptions { + public: + ArgumentsAndOptions() : mIsValid(false), mOptions(), mArguments() {} + + ArgumentsAndOptions(std::unordered_map<std::string, std::string> &&options, + std::unordered_map<std::string, std::vector<std::string>> &&arguments) + : mIsValid(true), mOptions(std::move(options)), mArguments(std::move(arguments)) {} + + bool isValid() const { + return mIsValid; + } + + bool hasOption(const std::string &optionName) const { + return mOptions.find(optionName) != mOptions.end(); + } + + private: + DISALLOW_ASSIGNMENT_OPERATOR(ArgumentsAndOptions); + + const bool mIsValid; + const std::unordered_map<std::string, std::string> mOptions; + const std::unordered_map<std::string, std::vector<std::string>> mArguments; +}; +} // namespace dicttoolkit +} // namespace latinime +#endif // LATINIME_DICT_TOOLKIT_ARGUMENTS_AND_OPTIONS_H |