aboutsummaryrefslogtreecommitdiffstats
path: root/native/dicttoolkit/src/utils/arguments_and_options.h
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-11-16 17:26:24 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-16 17:26:24 +0000
commit6a041e586d66720e915535a6ba50e94eb3abd30b (patch)
tree7fefaf882d2e8f8835b57ab37eb88a91581d4af3 /native/dicttoolkit/src/utils/arguments_and_options.h
parenta28e80e37c1f779ae9f56a9f3afcce474f0b10ab (diff)
parente7a72de8c28662e7a7855528d80c6a22a15fbcde (diff)
downloadlatinime-6a041e586d66720e915535a6ba50e94eb3abd30b.tar.gz
latinime-6a041e586d66720e915535a6ba50e94eb3abd30b.tar.xz
latinime-6a041e586d66720e915535a6ba50e94eb3abd30b.zip
am e7a72de8: Merge "Define arguments for commands in dicttoolkit."
* commit 'e7a72de8c28662e7a7855528d80c6a22a15fbcde': Define arguments for commands in dicttoolkit.
Diffstat (limited to 'native/dicttoolkit/src/utils/arguments_and_options.h')
-rw-r--r--native/dicttoolkit/src/utils/arguments_and_options.h54
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