changed: ConfParser -- now we can have a tree (spaces can have more than one level)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@768 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -70,6 +70,7 @@ bool read = false;
|
||||
|
||||
loc_parser.SplitSingle(true);
|
||||
loc_parser.UTF8(input_as_utf8);
|
||||
loc_parser.SetSpace(space);
|
||||
|
||||
if( loc_parser.Parse(file_name) == ConfParser::ok )
|
||||
{
|
||||
@@ -85,16 +86,16 @@ return read;
|
||||
|
||||
void Locale::AddLocale(size_t lang)
|
||||
{
|
||||
ConfParser::TableSingle::iterator i = loc_parser.space.table_single.begin();
|
||||
Space::TableSingle::iterator i = space.table_single.begin();
|
||||
|
||||
for( ; i != loc_parser.space.table_single.end() ; ++i)
|
||||
for( ; i != space.table_single.end() ; ++i)
|
||||
loc_tab[lang][i->first] = i->second;
|
||||
|
||||
|
||||
// lists
|
||||
ConfParser::Table::iterator i2 = loc_parser.space.table.begin();
|
||||
Space::Table::iterator i2 = space.table.begin();
|
||||
|
||||
for( ; i2 != loc_parser.space.table.end() ; ++i2)
|
||||
for( ; i2 != space.table.end() ; ++i2)
|
||||
loc_tab_multi[lang][i2->first] = i2->second;
|
||||
}
|
||||
|
||||
@@ -132,9 +133,9 @@ bool read = false;
|
||||
if( loc_parser.Parse(file_name) == ConfParser::ok )
|
||||
{
|
||||
read = true;
|
||||
CreateSubstVector(subst_url, loc_parser.space.table_single[L"url_original"], loc_parser.space.table_single[L"url_changeto"]);
|
||||
CreateSubstVector(subst_smalllet, loc_parser.space.table_single[L"smallleters"], loc_parser.space.table_single[L"capitalics"]);
|
||||
CreateSubstVector(subst_capitallet, loc_parser.space.table_single[L"capitalics"], loc_parser.space.table_single[L"smallleters"]);
|
||||
CreateSubstVector(subst_url, space.table_single[L"url_original"], space.table_single[L"url_changeto"]);
|
||||
CreateSubstVector(subst_smalllet, space.table_single[L"smallleters"], space.table_single[L"capitalics"]);
|
||||
CreateSubstVector(subst_capitallet, space.table_single[L"capitalics"], space.table_single[L"smallleters"]);
|
||||
|
||||
log << log3 << "Locale: read characters substitution tables from: " << file_name << logend;
|
||||
}
|
||||
@@ -275,7 +276,7 @@ bool Locale::IsKey(const std::wstring & key, size_t lang) const
|
||||
return false;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
Space::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
|
||||
if( i != loc_tab[lang].end() )
|
||||
return true;
|
||||
@@ -311,7 +312,7 @@ bool Locale::IsKeyLang(const std::wstring & key, size_t lang) const
|
||||
return false;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
Space::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
|
||||
return i != loc_tab[lang].end();
|
||||
}
|
||||
@@ -346,7 +347,7 @@ const std::wstring & Locale::Get(const std::wstring & key, size_t lang) const
|
||||
return empty;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
Space::TableSingle::const_iterator i = loc_tab[lang].find(key);
|
||||
|
||||
if( i != loc_tab[lang].end() )
|
||||
return i->second;
|
||||
@@ -383,7 +384,7 @@ bool Locale::IsKeyLangList(const std::wstring & key, size_t lang) const
|
||||
return false;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::Table::const_iterator i = loc_tab_multi[lang].find(key);
|
||||
Space::Table::const_iterator i = loc_tab_multi[lang].find(key);
|
||||
|
||||
return i != loc_tab_multi[lang].end();
|
||||
}
|
||||
@@ -401,7 +402,7 @@ const std::vector<std::wstring> & Locale::GetList(const std::wstring & key, size
|
||||
return empty_list;
|
||||
|
||||
// looking in the 'lang' language
|
||||
ConfParser::Table::const_iterator i = loc_tab_multi[lang].find(key);
|
||||
Space::Table::const_iterator i = loc_tab_multi[lang].find(key);
|
||||
|
||||
if( i != loc_tab_multi[lang].end() )
|
||||
return i->second;
|
||||
|
Reference in New Issue
Block a user