Loading native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s jlong dictOffset, jlong dictSize, jboolean isUpdatable) { PROF_OPEN; PROF_START(66); // TODO: Move dictionary buffer handling to policyimpl. const jsize sourceDirUtf8Length = env->GetStringUTFLength(sourceDir); if (sourceDirUtf8Length <= 0) { AKLOGE("DICT: Can't get sourceDir string"); Loading native/jni/src/suggest/core/dictionary/binary_dictionary_info.h +1 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,7 @@ class BinaryDictionaryInfo { } AK_FORCE_INLINE bool isDynamicallyUpdatable() const { // TODO: Support dynamic dictionary formats. const bool isUpdatableDictionaryFormat = false; const bool isUpdatableDictionaryFormat = mDictionaryHeader.supportsDynamicUpdate(); return mIsUpdatable && isUpdatableDictionaryFormat; } Loading native/jni/src/suggest/core/dictionary/dictionary.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ void Dictionary::addUnigramWord(const int *const word, const int length, const i AKLOGI("Warning: Dictionary::addUnigramWord() is called for non-updatable dictionary."); return; } // TODO: Support dynamic update mDictionaryStructureWithBufferPolicy->addUnigramWord(word, length, probability); } void Dictionary::addBigramWords(const int *const word0, const int length0, const int *const word1, Loading @@ -117,7 +117,8 @@ void Dictionary::addBigramWords(const int *const word0, const int length0, const AKLOGI("Warning: Dictionary::addBigramWords() is called for non-updatable dictionary."); return; } // TODO: Support dynamic update mDictionaryStructureWithBufferPolicy->addBigramWords(word0, length0, word1, length1, probability); } void Dictionary::removeBigramWords(const int *const word0, const int length0, Loading @@ -127,7 +128,7 @@ void Dictionary::removeBigramWords(const int *const word0, const int length0, AKLOGI("Warning: Dictionary::removeBigramWords() is called for non-updatable dictionary."); return; } // TODO: Support dynamic update mDictionaryStructureWithBufferPolicy->removeBigramWords(word0, length0, word1, length1); } void Dictionary::logDictionaryInfo(JNIEnv *const env) const { Loading native/jni/src/suggest/core/dictionary/dictionary.h +3 −3 Original line number Diff line number Diff line Loading @@ -94,9 +94,9 @@ class Dictionary { const BinaryDictionaryInfo mBinaryDictionaryInfo; DictionaryStructureWithBufferPolicy *const mDictionaryStructureWithBufferPolicy; const BigramDictionary *mBigramDictionary; SuggestInterface *mGestureSuggest; SuggestInterface *mTypingSuggest; const BigramDictionary *const mBigramDictionary; const SuggestInterface *const mGestureSuggest; const SuggestInterface *const mTypingSuggest; void logDictionaryInfo(JNIEnv *const env) const; }; Loading native/jni/src/suggest/core/policy/dictionary_structure_with_buffer_policy.h +12 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,18 @@ class DictionaryStructureWithBufferPolicy { virtual const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const = 0; // Returns whether the update was success or not. virtual bool addUnigramWord(const int *const word, const int length, const int probability) = 0; // Returns whether the update was success or not. virtual bool addBigramWords(const int *const word0, const int length0, const int *const word1, const int length1, const int probability) = 0; // Returns whether the update was success or not. virtual bool removeBigramWords(const int *const word0, const int length0, const int *const word1, const int length1) = 0; protected: DictionaryStructureWithBufferPolicy() {} Loading Loading
native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s jlong dictOffset, jlong dictSize, jboolean isUpdatable) { PROF_OPEN; PROF_START(66); // TODO: Move dictionary buffer handling to policyimpl. const jsize sourceDirUtf8Length = env->GetStringUTFLength(sourceDir); if (sourceDirUtf8Length <= 0) { AKLOGE("DICT: Can't get sourceDir string"); Loading
native/jni/src/suggest/core/dictionary/binary_dictionary_info.h +1 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,7 @@ class BinaryDictionaryInfo { } AK_FORCE_INLINE bool isDynamicallyUpdatable() const { // TODO: Support dynamic dictionary formats. const bool isUpdatableDictionaryFormat = false; const bool isUpdatableDictionaryFormat = mDictionaryHeader.supportsDynamicUpdate(); return mIsUpdatable && isUpdatableDictionaryFormat; } Loading
native/jni/src/suggest/core/dictionary/dictionary.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ void Dictionary::addUnigramWord(const int *const word, const int length, const i AKLOGI("Warning: Dictionary::addUnigramWord() is called for non-updatable dictionary."); return; } // TODO: Support dynamic update mDictionaryStructureWithBufferPolicy->addUnigramWord(word, length, probability); } void Dictionary::addBigramWords(const int *const word0, const int length0, const int *const word1, Loading @@ -117,7 +117,8 @@ void Dictionary::addBigramWords(const int *const word0, const int length0, const AKLOGI("Warning: Dictionary::addBigramWords() is called for non-updatable dictionary."); return; } // TODO: Support dynamic update mDictionaryStructureWithBufferPolicy->addBigramWords(word0, length0, word1, length1, probability); } void Dictionary::removeBigramWords(const int *const word0, const int length0, Loading @@ -127,7 +128,7 @@ void Dictionary::removeBigramWords(const int *const word0, const int length0, AKLOGI("Warning: Dictionary::removeBigramWords() is called for non-updatable dictionary."); return; } // TODO: Support dynamic update mDictionaryStructureWithBufferPolicy->removeBigramWords(word0, length0, word1, length1); } void Dictionary::logDictionaryInfo(JNIEnv *const env) const { Loading
native/jni/src/suggest/core/dictionary/dictionary.h +3 −3 Original line number Diff line number Diff line Loading @@ -94,9 +94,9 @@ class Dictionary { const BinaryDictionaryInfo mBinaryDictionaryInfo; DictionaryStructureWithBufferPolicy *const mDictionaryStructureWithBufferPolicy; const BigramDictionary *mBigramDictionary; SuggestInterface *mGestureSuggest; SuggestInterface *mTypingSuggest; const BigramDictionary *const mBigramDictionary; const SuggestInterface *const mGestureSuggest; const SuggestInterface *const mTypingSuggest; void logDictionaryInfo(JNIEnv *const env) const; }; Loading
native/jni/src/suggest/core/policy/dictionary_structure_with_buffer_policy.h +12 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,18 @@ class DictionaryStructureWithBufferPolicy { virtual const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const = 0; // Returns whether the update was success or not. virtual bool addUnigramWord(const int *const word, const int length, const int probability) = 0; // Returns whether the update was success or not. virtual bool addBigramWords(const int *const word0, const int length0, const int *const word1, const int length1, const int probability) = 0; // Returns whether the update was success or not. virtual bool removeBigramWords(const int *const word0, const int length0, const int *const word1, const int length1) = 0; protected: DictionaryStructureWithBufferPolicy() {} Loading