aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/terminal_attributes.h
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-05 21:36:20 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-05 21:36:20 -0800
commite1e5a3fa2f01d5fa01e529f2bda19234bb096aa1 (patch)
tree13e84f34caaeb998674213e113900d68f5139978 /native/src/terminal_attributes.h
parentecbf3f2cbc517b175fcf5252db61a815ea578978 (diff)
parent8e464d41cc891b7ef1c91b4cbeae68b5d6d56864 (diff)
downloadlatinime-e1e5a3fa2f01d5fa01e529f2bda19234bb096aa1.tar.gz
latinime-e1e5a3fa2f01d5fa01e529f2bda19234bb096aa1.tar.xz
latinime-e1e5a3fa2f01d5fa01e529f2bda19234bb096aa1.zip
Merge "Fill in the format-specific shortcut reading methods (A3)"
Diffstat (limited to 'native/src/terminal_attributes.h')
-rw-r--r--native/src/terminal_attributes.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/native/src/terminal_attributes.h b/native/src/terminal_attributes.h
index dcfeba450..1f9815936 100644
--- a/native/src/terminal_attributes.h
+++ b/native/src/terminal_attributes.h
@@ -30,20 +30,28 @@ class TerminalAttributes {
public:
class ShortcutIterator {
const uint8_t* const mDict;
+ bool mHasNextShortcutTarget;
int mPos;
public:
- ShortcutIterator(const uint8_t* const dict, const int pos) : mDict(dict), mPos(pos) {
+ ShortcutIterator(const uint8_t* dict, const int pos, const uint8_t flags) : mDict(dict),
+ mPos(pos) {
+ mHasNextShortcutTarget = (0 != (flags & UnigramDictionary::FLAG_HAS_SHORTCUT_TARGETS));
}
inline bool hasNextShortcutTarget() const {
- // TODO: stub method. Fill this in.
- return false;
+ return mHasNextShortcutTarget;
}
+ // Gets the shortcut target itself as a uint16_t string. For parameters and return value
+ // see BinaryFormat::getWordAtAddress.
inline int getNextShortcutTarget(const int maxDepth, uint16_t* outWord) {
- // TODO: stub method. Fill this in.
- return 0;
+ const int shortcutFlags = BinaryFormat::getFlagsAndForwardPointer(mDict, &mPos);
+ mHasNextShortcutTarget =
+ 0 != (shortcutFlags & UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT);
+ int shortcutAddress =
+ BinaryFormat::getAttributeAddressAndForwardPointer(mDict, shortcutFlags, &mPos);
+ return BinaryFormat::getWordAtAddress(mDict, shortcutAddress, maxDepth, outWord);
}
};
@@ -58,12 +66,11 @@ class TerminalAttributes {
}
inline bool isShortcutOnly() const {
- // TODO: stub method. Fill this in.
- return false;
+ return 0 != (mFlags & UnigramDictionary::FLAG_IS_SHORTCUT_ONLY);
}
inline ShortcutIterator getShortcutIterator() const {
- return ShortcutIterator(mDict, mStartPos);
+ return ShortcutIterator(mDict, mStartPos, mFlags);
}
};
} // namespace latinime