diff options
author | 2011-07-13 21:30:30 -0700 | |
---|---|---|
committer | 2011-07-13 21:30:30 -0700 | |
commit | 46f2d44a29de4034afa37c426dc0f1f1a40b7480 (patch) | |
tree | 2c3fba5291f788e0c8bdd2ddac955a8c971f3765 /native/src/proximity_info.cpp | |
parent | b2ba41397f14d22e2088fac3306c02a0d587efe6 (diff) | |
parent | 1d7eaf8462e19604faeb239a72ee325a93986894 (diff) | |
download | latinime-46f2d44a29de4034afa37c426dc0f1f1a40b7480.tar.gz latinime-46f2d44a29de4034afa37c426dc0f1f1a40b7480.tar.xz latinime-46f2d44a29de4034afa37c426dc0f1f1a40b7480.zip |
Merge "(Step 1) Move proximity related parameters from unigram_dictionary to proximity_info"
Diffstat (limited to 'native/src/proximity_info.cpp')
-rw-r--r-- | native/src/proximity_info.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/native/src/proximity_info.cpp b/native/src/proximity_info.cpp index 209c31e6e..ebf83a7e7 100644 --- a/native/src/proximity_info.cpp +++ b/native/src/proximity_info.cpp @@ -63,4 +63,29 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const { return false; } +// TODO: Calculate nearby codes here. +void ProximityInfo::setInputParams(const int* inputCodes, const int inputLength) { + mInputCodes = inputCodes; + mInputLength = inputLength; +} + +const int* ProximityInfo::getProximityCharsAt(const int index) const { + return mInputCodes + (index * MAX_PROXIMITY_CHARS_SIZE); +} + +bool ProximityInfo::sameAsTyped(const unsigned short *word, int length) const { + if (length != mInputLength) { + return false; + } + const int *inputCodes = mInputCodes; + while (length--) { + if ((unsigned int) *inputCodes != (unsigned int) *word) { + return false; + } + inputCodes += MAX_PROXIMITY_CHARS_SIZE; + word++; + } + return true; +} + } // namespace latinime |