updated to the new Pikotools API

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1071 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-01-06 18:12:53 +00:00
parent 3eff400d88
commit ccf78dcb02
48 changed files with 766 additions and 390 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -112,9 +112,7 @@ bool read = false;
file_name += '/';
file_name += file;
loc_parser.SplitSingle(true);
loc_parser.SetSpace(temp_space);
PT::SpaceParser::Status status = loc_parser.Parse(file_name);
if( status == PT::SpaceParser::ok )
@@ -135,7 +133,7 @@ return read;
void Locale::AddLocale(const char * file)
{
std::wstring * id_str = temp_space.GetValue(L"winix_locale_id");
std::wstring * id_str = temp_space.GetFirstValue(L"winix_locale_id");
if( !id_str )
{
@@ -186,16 +184,19 @@ bool read = false;
file_name += '/';
file_name += "substitute";
loc_parser.SplitSingle(true);
loc_parser.SetSpace(temp_space);
if( loc_parser.Parse(file_name) == PT::SpaceParser::ok )
{
read = true;
CreateSubstVector(subst_url, temp_space.table_single[L"url_original"], temp_space.table_single[L"url_changeto"]);
CreateSubstVector(subst_smalllet, temp_space.table_single[L"smallleters"], temp_space.table_single[L"capitalics"]);
CreateSubstVector(subst_capitallet, temp_space.table_single[L"capitalics"], temp_space.table_single[L"smallleters"]);
CreateSubstSortVector(subst_sort, temp_space.table[L"sort"]);
CreateSubstVector(subst_url, temp_space.Text(L"url_original"), temp_space.Text(L"url_changeto"));
CreateSubstVector(subst_smalllet, temp_space.Text(L"smallleters"), temp_space.Text(L"capitalics"));
CreateSubstVector(subst_capitallet, temp_space.Text(L"capitalics"), temp_space.Text(L"smallleters"));
std::vector<std::wstring> * sort_vec = temp_space.GetValue(L"sort");
if( sort_vec )
CreateSubstSortVector(subst_sort, *sort_vec);
log << log3 << "Locale: read characters substitution tables from: " << file_name << logend;
}
@@ -360,7 +361,7 @@ const std::wstring * Locale::GetKeyInLanguage(const std::wstring & key, size_t l
size_t index = locale_indices[lang_id];
if( index < locale_tab.size() )
return locale_tab[index].GetValue(key);
return locale_tab[index].GetFirstValue(key);
}
return 0;
@@ -581,7 +582,7 @@ const std::wstring & Locale::GetByIndex(const std::wstring & key, size_t index,
{
if( index < locale_tab.size() )
{
const std::wstring * value = locale_tab[index].GetValue(key);
const std::wstring * value = locale_tab[index].GetFirstValue(key);
if( value )
return *value;