Loading native/jni/Android.mk +3 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ include $(CLEAR_VARS) LATIN_IME_SRC_DIR := src LATIN_IME_SRC_FULLPATH_DIR := $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR) LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/gesture LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/suggest LOCAL_CFLAGS += -Werror -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-align \ -Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls -Wno-system-headers Loading Loading @@ -57,8 +57,8 @@ LATIN_IME_CORE_SRC_FILES := \ proximity_info_state.cpp \ unigram_dictionary.cpp \ words_priority_queue.cpp \ gesture/gesture_decoder_wrapper.cpp \ gesture/typing_decoder_wrapper.cpp suggest/gesture_suggest.cpp \ suggest/typing_suggest.cpp LOCAL_SRC_FILES := \ $(LATIN_IME_JNI_SRC_FILES) \ Loading native/jni/src/dictionary.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include "defines.h" #include "dictionary.h" #include "dic_traverse_wrapper.h" #include "gesture_decoder_wrapper.h" #include "gesture_suggest.h" #include "unigram_dictionary.h" namespace latinime { Loading @@ -36,7 +36,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, mUnigramDictionary(new UnigramDictionary(mOffsetDict, maxWordLength, maxWords, BinaryFormat::getFlags(mDict))), mBigramDictionary(new BigramDictionary(mOffsetDict, maxWordLength, maxPredictions)), mGestureDecoder(new GestureDecoderWrapper(maxWordLength, maxWords)) { mGestureSuggest(new GestureSuggest(maxWordLength, maxWords)) { if (DEBUG_DICT) { if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) { AKLOGI("Max word length (%d) is greater than %d", Loading @@ -49,7 +49,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, Dictionary::~Dictionary() { delete mUnigramDictionary; delete mBigramDictionary; delete mGestureDecoder; delete mGestureSuggest; } int Dictionary::getSuggestions(ProximityInfo *proximityInfo, void *traverseSession, Loading @@ -61,7 +61,7 @@ int Dictionary::getSuggestions(ProximityInfo *proximityInfo, void *traverseSessi if (isGesture) { DicTraverseWrapper::initDicTraverseSession( traverseSession, this, prevWordChars, prevWordLength); result = mGestureDecoder->getSuggestions(proximityInfo, traverseSession, result = mGestureSuggest->getSuggestions(proximityInfo, traverseSession, xcoordinates, ycoordinates, times, pointerIds, codes, codesSize, commitPoint, outWords, frequencies, spaceIndices, outputTypes); if (DEBUG_DICT) { Loading native/jni/src/dictionary.h +2 −2 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ namespace latinime { class BigramDictionary; class IncrementalDecoderInterface; class ProximityInfo; class SuggestInterface; class UnigramDictionary; class Dictionary { Loading Loading @@ -83,7 +83,7 @@ class Dictionary { const UnigramDictionary *mUnigramDictionary; const BigramDictionary *mBigramDictionary; IncrementalDecoderInterface *mGestureDecoder; SuggestInterface *mGestureSuggest; }; // public static utility methods Loading native/jni/src/gesture/typing_decoder_wrapper.cpp→native/jni/src/suggest/gesture_suggest.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -14,13 +14,12 @@ * limitations under the License. */ #include "typing_decoder_wrapper.h" #include "gesture_suggest.h" namespace latinime { IncrementalDecoderInterface * (*TypingDecoderWrapper::sIncrementalDecoderFactoryMethod)(int, int) = 0; SuggestInterface *(*GestureSuggest::sGestureSuggestFactoryMethod)(int, int) = 0; TypingDecoderWrapper::~TypingDecoderWrapper() { delete mIncrementalDecoderInterface; GestureSuggest::~GestureSuggest() { delete mSuggestInterface; } } // namespace latinime native/jni/src/gesture/gesture_decoder_wrapper.h→native/jni/src/suggest/gesture_suggest.h +18 −21 Original line number Diff line number Diff line Loading @@ -14,53 +14,50 @@ * limitations under the License. */ #ifndef LATINIME_GESTURE_DECODER_WRAPPER_H #define LATINIME_GESTURE_DECODER_WRAPPER_H #ifndef LATINIME_GESTURE_SUGGEST_H #define LATINIME_GESTURE_SUGGEST_H #include "defines.h" #include "incremental_decoder_interface.h" #include "suggest_interface.h" namespace latinime { class UnigramDictionary; class BigramDictionary; class ProximityInfo; class GestureDecoderWrapper : public IncrementalDecoderInterface { class GestureSuggest : public SuggestInterface { public: GestureDecoderWrapper(const int maxWordLength, const int maxWords) : mIncrementalDecoderInterface(getGestureDecoderInstance(maxWordLength, maxWords)) { GestureSuggest(const int maxWordLength, const int maxWords) : mSuggestInterface(getGestureSuggestInstance(maxWordLength, maxWords)) { } virtual ~GestureDecoderWrapper(); virtual ~GestureSuggest(); int getSuggestions(ProximityInfo *pInfo, void *traverseSession, int *inputXs, int *inputYs, int *times, int *pointerIds, int *codes, int inputSize, int commitPoint, int *outWords, int *frequencies, int *outputIndices, int *outputTypes) const { if (!mIncrementalDecoderInterface) { if (!mSuggestInterface) { return 0; } return mIncrementalDecoderInterface->getSuggestions(pInfo, traverseSession, inputXs, return mSuggestInterface->getSuggestions(pInfo, traverseSession, inputXs, inputYs, times, pointerIds, codes, inputSize, commitPoint, outWords, frequencies, outputIndices, outputTypes); } static void setGestureDecoderFactoryMethod( IncrementalDecoderInterface *(*factoryMethod)(int, int)) { sGestureDecoderFactoryMethod = factoryMethod; static void setGestureSuggestFactoryMethod(SuggestInterface *(*factoryMethod)(int, int)) { sGestureSuggestFactoryMethod = factoryMethod; } private: DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoderWrapper); static IncrementalDecoderInterface *getGestureDecoderInstance(int maxWordLength, int maxWords) { if (sGestureDecoderFactoryMethod) { return sGestureDecoderFactoryMethod(maxWordLength, maxWords); DISALLOW_IMPLICIT_CONSTRUCTORS(GestureSuggest); static SuggestInterface *getGestureSuggestInstance(int maxWordLength, int maxWords) { if (sGestureSuggestFactoryMethod) { return sGestureSuggestFactoryMethod(maxWordLength, maxWords); } return 0; } static IncrementalDecoderInterface *(*sGestureDecoderFactoryMethod)(int, int); IncrementalDecoderInterface *mIncrementalDecoderInterface; static SuggestInterface *(*sGestureSuggestFactoryMethod)(int, int); SuggestInterface *mSuggestInterface; }; } // namespace latinime #endif // LATINIME_GESTURE_DECODER_WRAPPER_H #endif // LATINIME_GESTURE_SUGGEST_H Loading
native/jni/Android.mk +3 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ include $(CLEAR_VARS) LATIN_IME_SRC_DIR := src LATIN_IME_SRC_FULLPATH_DIR := $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR) LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/gesture LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/suggest LOCAL_CFLAGS += -Werror -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-align \ -Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls -Wno-system-headers Loading Loading @@ -57,8 +57,8 @@ LATIN_IME_CORE_SRC_FILES := \ proximity_info_state.cpp \ unigram_dictionary.cpp \ words_priority_queue.cpp \ gesture/gesture_decoder_wrapper.cpp \ gesture/typing_decoder_wrapper.cpp suggest/gesture_suggest.cpp \ suggest/typing_suggest.cpp LOCAL_SRC_FILES := \ $(LATIN_IME_JNI_SRC_FILES) \ Loading
native/jni/src/dictionary.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include "defines.h" #include "dictionary.h" #include "dic_traverse_wrapper.h" #include "gesture_decoder_wrapper.h" #include "gesture_suggest.h" #include "unigram_dictionary.h" namespace latinime { Loading @@ -36,7 +36,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, mUnigramDictionary(new UnigramDictionary(mOffsetDict, maxWordLength, maxWords, BinaryFormat::getFlags(mDict))), mBigramDictionary(new BigramDictionary(mOffsetDict, maxWordLength, maxPredictions)), mGestureDecoder(new GestureDecoderWrapper(maxWordLength, maxWords)) { mGestureSuggest(new GestureSuggest(maxWordLength, maxWords)) { if (DEBUG_DICT) { if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) { AKLOGI("Max word length (%d) is greater than %d", Loading @@ -49,7 +49,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, Dictionary::~Dictionary() { delete mUnigramDictionary; delete mBigramDictionary; delete mGestureDecoder; delete mGestureSuggest; } int Dictionary::getSuggestions(ProximityInfo *proximityInfo, void *traverseSession, Loading @@ -61,7 +61,7 @@ int Dictionary::getSuggestions(ProximityInfo *proximityInfo, void *traverseSessi if (isGesture) { DicTraverseWrapper::initDicTraverseSession( traverseSession, this, prevWordChars, prevWordLength); result = mGestureDecoder->getSuggestions(proximityInfo, traverseSession, result = mGestureSuggest->getSuggestions(proximityInfo, traverseSession, xcoordinates, ycoordinates, times, pointerIds, codes, codesSize, commitPoint, outWords, frequencies, spaceIndices, outputTypes); if (DEBUG_DICT) { Loading
native/jni/src/dictionary.h +2 −2 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ namespace latinime { class BigramDictionary; class IncrementalDecoderInterface; class ProximityInfo; class SuggestInterface; class UnigramDictionary; class Dictionary { Loading Loading @@ -83,7 +83,7 @@ class Dictionary { const UnigramDictionary *mUnigramDictionary; const BigramDictionary *mBigramDictionary; IncrementalDecoderInterface *mGestureDecoder; SuggestInterface *mGestureSuggest; }; // public static utility methods Loading
native/jni/src/gesture/typing_decoder_wrapper.cpp→native/jni/src/suggest/gesture_suggest.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -14,13 +14,12 @@ * limitations under the License. */ #include "typing_decoder_wrapper.h" #include "gesture_suggest.h" namespace latinime { IncrementalDecoderInterface * (*TypingDecoderWrapper::sIncrementalDecoderFactoryMethod)(int, int) = 0; SuggestInterface *(*GestureSuggest::sGestureSuggestFactoryMethod)(int, int) = 0; TypingDecoderWrapper::~TypingDecoderWrapper() { delete mIncrementalDecoderInterface; GestureSuggest::~GestureSuggest() { delete mSuggestInterface; } } // namespace latinime
native/jni/src/gesture/gesture_decoder_wrapper.h→native/jni/src/suggest/gesture_suggest.h +18 −21 Original line number Diff line number Diff line Loading @@ -14,53 +14,50 @@ * limitations under the License. */ #ifndef LATINIME_GESTURE_DECODER_WRAPPER_H #define LATINIME_GESTURE_DECODER_WRAPPER_H #ifndef LATINIME_GESTURE_SUGGEST_H #define LATINIME_GESTURE_SUGGEST_H #include "defines.h" #include "incremental_decoder_interface.h" #include "suggest_interface.h" namespace latinime { class UnigramDictionary; class BigramDictionary; class ProximityInfo; class GestureDecoderWrapper : public IncrementalDecoderInterface { class GestureSuggest : public SuggestInterface { public: GestureDecoderWrapper(const int maxWordLength, const int maxWords) : mIncrementalDecoderInterface(getGestureDecoderInstance(maxWordLength, maxWords)) { GestureSuggest(const int maxWordLength, const int maxWords) : mSuggestInterface(getGestureSuggestInstance(maxWordLength, maxWords)) { } virtual ~GestureDecoderWrapper(); virtual ~GestureSuggest(); int getSuggestions(ProximityInfo *pInfo, void *traverseSession, int *inputXs, int *inputYs, int *times, int *pointerIds, int *codes, int inputSize, int commitPoint, int *outWords, int *frequencies, int *outputIndices, int *outputTypes) const { if (!mIncrementalDecoderInterface) { if (!mSuggestInterface) { return 0; } return mIncrementalDecoderInterface->getSuggestions(pInfo, traverseSession, inputXs, return mSuggestInterface->getSuggestions(pInfo, traverseSession, inputXs, inputYs, times, pointerIds, codes, inputSize, commitPoint, outWords, frequencies, outputIndices, outputTypes); } static void setGestureDecoderFactoryMethod( IncrementalDecoderInterface *(*factoryMethod)(int, int)) { sGestureDecoderFactoryMethod = factoryMethod; static void setGestureSuggestFactoryMethod(SuggestInterface *(*factoryMethod)(int, int)) { sGestureSuggestFactoryMethod = factoryMethod; } private: DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoderWrapper); static IncrementalDecoderInterface *getGestureDecoderInstance(int maxWordLength, int maxWords) { if (sGestureDecoderFactoryMethod) { return sGestureDecoderFactoryMethod(maxWordLength, maxWords); DISALLOW_IMPLICIT_CONSTRUCTORS(GestureSuggest); static SuggestInterface *getGestureSuggestInstance(int maxWordLength, int maxWords) { if (sGestureSuggestFactoryMethod) { return sGestureSuggestFactoryMethod(maxWordLength, maxWords); } return 0; } static IncrementalDecoderInterface *(*sGestureDecoderFactoryMethod)(int, int); IncrementalDecoderInterface *mIncrementalDecoderInterface; static SuggestInterface *(*sGestureSuggestFactoryMethod)(int, int); SuggestInterface *mSuggestInterface; }; } // namespace latinime #endif // LATINIME_GESTURE_DECODER_WRAPPER_H #endif // LATINIME_GESTURE_SUGGEST_H