aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/terminal_attributes.h
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-05 19:28:50 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-01-05 19:28:50 -0800
commitf6e4fe19f573658b7f0af21f29937d884b644e5e (patch)
tree0e9ad9b77e909469165821ce46c5b74d67e03108 /native/src/terminal_attributes.h
parent8dc3a544bd0b33f830f0798bb394394a9357e269 (diff)
parentcf9dbbdd1ade7cf1d05f3cb080018931aa540e61 (diff)
downloadlatinime-f6e4fe19f573658b7f0af21f29937d884b644e5e.tar.gz
latinime-f6e4fe19f573658b7f0af21f29937d884b644e5e.tar.xz
latinime-f6e4fe19f573658b7f0af21f29937d884b644e5e.zip
am cf9dbbdd: Add methods to read shortcuts from the binary dict (A2)
* commit 'cf9dbbdd1ade7cf1d05f3cb080018931aa540e61': Add methods to read shortcuts from the binary dict (A2)
Diffstat (limited to 'native/src/terminal_attributes.h')
-rw-r--r--native/src/terminal_attributes.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/native/src/terminal_attributes.h b/native/src/terminal_attributes.h
new file mode 100644
index 000000000..dcfeba450
--- /dev/null
+++ b/native/src/terminal_attributes.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 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_TERMINAL_ATTRIBUTES_H
+#define LATINIME_TERMINAL_ATTRIBUTES_H
+
+#include "unigram_dictionary.h"
+
+namespace latinime {
+
+/**
+ * This class encapsulates information about a terminal that allows to
+ * retrieve local node attributes like the list of shortcuts without
+ * exposing the format structure to the client.
+ */
+class TerminalAttributes {
+ public:
+ class ShortcutIterator {
+ const uint8_t* const mDict;
+ int mPos;
+
+ public:
+ ShortcutIterator(const uint8_t* const dict, const int pos) : mDict(dict), mPos(pos) {
+ }
+
+ inline bool hasNextShortcutTarget() const {
+ // TODO: stub method. Fill this in.
+ return false;
+ }
+
+ inline int getNextShortcutTarget(const int maxDepth, uint16_t* outWord) {
+ // TODO: stub method. Fill this in.
+ return 0;
+ }
+ };
+
+ private:
+ const uint8_t* const mDict;
+ const uint8_t mFlags;
+ const int mStartPos;
+
+ public:
+ TerminalAttributes(const uint8_t* const dict, const uint8_t flags, const int pos) :
+ mDict(dict), mFlags(flags), mStartPos(pos) {
+ }
+
+ inline bool isShortcutOnly() const {
+ // TODO: stub method. Fill this in.
+ return false;
+ }
+
+ inline ShortcutIterator getShortcutIterator() const {
+ return ShortcutIterator(mDict, mStartPos);
+ }
+};
+} // namespace latinime
+
+#endif // LATINIME_TERMINAL_ATTRIBUTES_H