diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-11-27 08:19:22 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-11-27 08:19:22 +0200 |
commit | d0c7b4fade611bb3bd05a4e6230145b1babc9f7f (patch) | |
tree | 96edb360c7cacaef64a4b865e7d97c9ef8404669 /indra/llui/llspellcheck.cpp | |
parent | 49216183902045a2b9ba4a0627eb4298a65c004c (diff) | |
parent | 78bdf57ad6610b34389226bf941ba736ca0c2225 (diff) |
Merged in lindenlab/viewer-release
Diffstat (limited to 'indra/llui/llspellcheck.cpp')
-rw-r--r-- | indra/llui/llspellcheck.cpp | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 7f64743e99..296ea09079 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -44,7 +44,6 @@ static const std::string DICT_FILE_IGNORE = "user_ignore.dic"; static const std::string DICT_FILE_MAIN = "dictionaries.xml"; static const std::string DICT_FILE_USER = "user_dictionaries.xml"; -LLSD LLSpellChecker::sDictMap; LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal; LLSpellChecker::LLSpellChecker() @@ -94,10 +93,9 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str return suggestions.size(); } -// static const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language) { - for (LLSD::array_const_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it) + for (LLSD::array_const_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it) { const LLSD& dict_entry = *it; if (dict_language == dict_entry["language"].asString()) @@ -108,14 +106,12 @@ const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language) return LLSD(); } -// static bool LLSpellChecker::hasDictionary(const std::string& dict_language, bool check_installed) { const LLSD dict_info = getDictionaryData(dict_language); return dict_info.has("language") && ( (!check_installed) || (dict_info["installed"].asBoolean()) ); } -// static void LLSpellChecker::setDictionaryData(const LLSD& dict_info) { const std::string dict_language = dict_info["language"].asString(); @@ -124,7 +120,7 @@ void LLSpellChecker::setDictionaryData(const LLSD& dict_info) return; } - for (LLSD::array_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it) + for (LLSD::array_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it) { LLSD& dict_entry = *it; if (dict_language == dict_entry["language"].asString()) @@ -133,7 +129,7 @@ void LLSpellChecker::setDictionaryData(const LLSD& dict_info) return; } } - sDictMap.append(dict_info); + mDictMap.append(dict_info); return; } @@ -147,14 +143,14 @@ void LLSpellChecker::refreshDictionaryMap() std::string user_filename(user_path + DICT_FILE_MAIN); llifstream user_file(user_filename.c_str(), std::ios::binary); if ( (!user_file.is_open()) - || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, user_file)) - || (0 == sDictMap.size()) ) + || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(mDictMap, user_file)) + || (0 == mDictMap.size()) ) { std::string app_filename(app_path + DICT_FILE_MAIN); llifstream app_file(app_filename.c_str(), std::ios::binary); if ( (!app_file.is_open()) - || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, app_file)) - || (0 == sDictMap.size()) ) + || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(mDictMap, app_file)) + || (0 == mDictMap.size()) ) { return; } @@ -178,7 +174,7 @@ void LLSpellChecker::refreshDictionaryMap() // Look for installed dictionaries std::string tmp_app_path, tmp_user_path; - for (LLSD::array_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it) + for (LLSD::array_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it) { LLSD& sdDict = *it; tmp_app_path = (sdDict.has("name")) ? app_path + sdDict["name"].asString() : LLStringUtil::null; @@ -416,7 +412,6 @@ bool LLSpellChecker::getUseSpellCheck() return (LLSpellChecker::instanceExists()) && (LLSpellChecker::instance().mHunspell); } -// static bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language) { // Only user-installed inactive dictionaries can be removed @@ -426,7 +421,6 @@ bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language) ( (!getUseSpellCheck()) || (!LLSpellChecker::instance().isActiveDictionary(dict_language)) ); } -// static void LLSpellChecker::removeDictionary(const std::string& dict_language) { if (!canRemoveDictionary(dict_language)) @@ -499,12 +493,3 @@ void LLSpellChecker::setUseSpellCheck(const std::string& dict_language) LLSpellChecker::instance().initHunspell(dict_language); } } - -// static -void LLSpellChecker::initClass() -{ - if (sDictMap.isUndefined()) - { - refreshDictionaryMap(); - } -} |