X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FWordList.cpp;h=2f8ce2bd524848245933ab5a2dad624235517f20;hb=19478f3efa546378818af103be9c03cd63d9fc54;hp=558ddf8a1872ff4b11d408fc1a33715453f59afd;hpb=5d0e49d4dcd5666feeddc5b9d5fa14dd4b654219;p=lyx.git diff --git a/src/WordList.cpp b/src/WordList.cpp index 558ddf8a18..2f8ce2bd52 100644 --- a/src/WordList.cpp +++ b/src/WordList.cpp @@ -12,21 +12,32 @@ #include "WordList.h" +#include "Language.h" + #include "support/convert.h" #include "support/debug.h" #include "support/docstring.h" #include "support/weighted_btree.h" -#include +#include "support/lassert.h" + +#include + +using namespace std; namespace lyx { /// -WordList theGlobalWordList; +map theGlobalWordList; -WordList & theWordList() +WordList * theWordList(Language const & lang) { - return theGlobalWordList; + map::iterator it = theGlobalWordList.find(lang); + if (it != theGlobalWordList.end()) + return it->second; + else + theGlobalWordList[lang] = new WordList(); + return theGlobalWordList[lang]; } /// @@ -62,7 +73,7 @@ WordList::~WordList() docstring const & WordList::word(size_t idx) const { Impl::Words::const_iterator it = d->words_.find_summed_weight(idx); - BOOST_ASSERT(it != d->words_.end()); + LASSERT(it != d->words_.end(), /**/); // We use the key() method here, and not something like it->first // because the btree only returns (iterator-) temporary value pairs.