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:23:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-16 17:23:56 +0000
commite7a72de8c28662e7a7855528d80c6a22a15fbcde (patch)
treeca5f5758ed63ef4ba1a8b36417e6b16db103ba3d /native/dicttoolkit/src/utils/arguments_and_options.h
parent37f5b0d4ff4e4abbd3f8da8b606aef7ac8340485 (diff)
parent79273b04772824a8c547e1a8d33900040a03264b (diff)
downloadlatinime-e7a72de8c28662e7a7855528d80c6a22a15fbcde.tar.gz
latinime-e7a72de8c28662e7a7855528d80c6a22a15fbcde.tar.xz
latinime-e7a72de8c28662e7a7855528d80c6a22a15fbcde.zip
Merge "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