diff options
author | 2014-02-04 23:51:05 +0900 | |
---|---|---|
committer | 2014-02-05 17:35:25 +0900 | |
commit | 43cf9076b2d053c554941e55f6073b8f586c510b (patch) | |
tree | 80bc1df381a0a75a1ecb48dc723b8cb97abaf68c /native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp | |
parent | aac53dd7f55c5175ac8950617750b3d5c2adcf59 (diff) | |
download | latinime-43cf9076b2d053c554941e55f6073b8f586c510b.tar.gz latinime-43cf9076b2d053c554941e55f6073b8f586c510b.tar.xz latinime-43cf9076b2d053c554941e55f6073b8f586c510b.zip |
[HD04] Make the locale mandatory.
Bug: 11281748
Change-Id: I69281b0053bec404c3e3c713ade3f65a140f51b1
Diffstat (limited to 'native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp')
-rw-r--r-- | native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp index 7504524f0..b5b5ed740 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp @@ -32,6 +32,7 @@ const char *const HeaderPolicy::EXTENDED_REGION_SIZE_KEY = "EXTENDED_REGION_SIZE // Historical info is information that is needed to support decaying such as timestamp, level and // count. const char *const HeaderPolicy::HAS_HISTORICAL_INFO_KEY = "HAS_HISTORICAL_INFO"; +const char *const HeaderPolicy::LOCALE_KEY = "locale"; // match Java declaration const int HeaderPolicy::DEFAULT_MULTIPLE_WORDS_DEMOTION_RATE = 100; const float HeaderPolicy::MULTIPLE_WORD_COST_MULTIPLIER_SCALE = 100.0f; @@ -59,6 +60,10 @@ void HeaderPolicy::readHeaderValueOrQuestionMark(const char *const key, int *out outValue[terminalIndex] = '\0'; } +const std::vector<int> HeaderPolicy::readLocale() const { + return HeaderReadWriteUtils::readCodePointVectorAttributeValue(&mAttributeMap, LOCALE_KEY); +} + float HeaderPolicy::readMultipleWordCostMultiplier() const { const int demotionRate = HeaderReadWriteUtils::readIntAttributeValue(&mAttributeMap, MULTIPLE_WORDS_DEMOTION_RATE_KEY, DEFAULT_MULTIPLE_WORDS_DEMOTION_RATE); @@ -116,6 +121,7 @@ void HeaderPolicy::fillInHeader(const bool updatesLastDecayedTime, const int uni // Set the current time as the generation time. HeaderReadWriteUtils::setIntAttribute(outAttributeMap, DATE_KEY, TimeKeeper::peekCurrentTime()); + HeaderReadWriteUtils::setCodePointVectorAttribute(outAttributeMap, LOCALE_KEY, mLocale); if (updatesLastDecayedTime) { // Set current time as the last updated time. HeaderReadWriteUtils::setIntAttribute(outAttributeMap, LAST_DECAYED_TIME_KEY, |