/* * This file is a part of TTCalc - a mathematical calculator * and is distributed under the (new) BSD licence. * Author: Tomasz Sowa */ /* * Copyright (c) 2006-2007, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name Tomasz Sowa nor the names of contributors to this * project may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include "compileconfig.h" #include "languages.h" const char * Languages::ErrorMessage(Country country, ttmath::ErrorCode code) { const char * unk_err = "unknown error"; if( error_messages_tab.empty() ) InitErrorMessagesTab(); unsigned int cid = static_cast( country ); if( cid >= error_messages_tab.size() ) return unk_err; std::map::const_iterator i; i = error_messages_tab[cid].find( code ); if( i == error_messages_tab[cid].end() ) return unk_err; return i->second.c_str(); } const char * Languages::ErrorMessage(ttmath::ErrorCode code) { return ErrorMessage(current_country, code); } void Languages::InsertErrorPair(ttmath::ErrorCode code, const char * message) { if( error_messages_tab.empty() ) return; error_messages_tab.back().insert( std::make_pair(code, message) ); } void Languages::InitErrorMessagesTab() { error_messages_tab.push_back( std::map() ); InsertErrorPair(ttmath::err_ok,"ok"); InsertErrorPair(ttmath::err_nothing_has_read,""); InsertErrorPair(ttmath::err_unknown_character,"An unknown character"); InsertErrorPair(ttmath::err_unexpected_final_bracket,"An unexpected final bracket"); InsertErrorPair(ttmath::err_stack_not_clear,"An unknown character has left"); InsertErrorPair(ttmath::err_unknown_variable,"An unknown variable"); InsertErrorPair(ttmath::err_division_by_zero,"Division by zero"); InsertErrorPair(ttmath::err_interrupt,"The calculating has been broken"); InsertErrorPair(ttmath::err_overflow,"Overflow"); InsertErrorPair(ttmath::err_unknown_function,"An unknown function"); InsertErrorPair(ttmath::err_unknown_operator,"An unknown operator"); InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"An unexpected semicolon operator"); InsertErrorPair(ttmath::err_improper_amount_of_arguments,"Improper amount of arguments"); InsertErrorPair(ttmath::err_improper_argument,"Improper argument"); InsertErrorPair(ttmath::err_unexpected_end,"Unexpected end"); InsertErrorPair(ttmath::err_internal_error,"An internal error"); InsertErrorPair(ttmath::err_incorrect_name,"Incorrect name of a variable or function"); InsertErrorPair(ttmath::err_incorrect_value,"Incorrect value of a variable or function"); InsertErrorPair(ttmath::err_variable_exists,"This variable already exists"); InsertErrorPair(ttmath::err_variable_loop,"There's a recurrence between variables"); InsertErrorPair(ttmath::err_functions_loop,"There's a recurrence between functions"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Variables or functions must return only one value"); InsertErrorPair(ttmath::err_still_calculating,"Calculating..."); InsertErrorPair(ttmath::err_too_big_factorial,"A too big argument for the factorial() function"); // pl error_messages_tab.push_back( std::map() ); InsertErrorPair(ttmath::err_ok,"ok"); InsertErrorPair(ttmath::err_nothing_has_read,""); InsertErrorPair(ttmath::err_unknown_character,"Nieznany znak"); InsertErrorPair(ttmath::err_unexpected_final_bracket,"Nieoczekiwany nawias zamykający"); InsertErrorPair(ttmath::err_stack_not_clear,"Pozostał nieznany znak"); InsertErrorPair(ttmath::err_unknown_variable,"Nieznana zmienna"); InsertErrorPair(ttmath::err_division_by_zero,"Dzielenie przez zero"); InsertErrorPair(ttmath::err_interrupt,"Obliczenia zostały przerwane"); InsertErrorPair(ttmath::err_overflow,"Przekroczony zakres"); InsertErrorPair(ttmath::err_unknown_function,"Nieznana funkcja"); InsertErrorPair(ttmath::err_unknown_operator,"Nieznany operator"); InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"Nieoczekiwany operator 'średnik'"); InsertErrorPair(ttmath::err_improper_amount_of_arguments,"Niewłaściwa liczba argumentów"); InsertErrorPair(ttmath::err_improper_argument,"Niewłaściwy argument"); InsertErrorPair(ttmath::err_unexpected_end,"Nieoczekiwany koniec"); InsertErrorPair(ttmath::err_internal_error,"Błąd wewnętrzny programu!"); InsertErrorPair(ttmath::err_incorrect_name,"Nieprawidłowa nazwa zmiennej lub funkcji"); InsertErrorPair(ttmath::err_incorrect_value,"Nieprawidłowa wartość zmiennej lub funkcji"); InsertErrorPair(ttmath::err_variable_exists,"Ta zmienna juz istnieje"); InsertErrorPair(ttmath::err_variable_loop,"Pomiędzy zmiennymi zachodzi wywołanie rekurencyjne"); InsertErrorPair(ttmath::err_functions_loop,"Pomiędzy funkcjami zachodzi wywołanie rekurencyjne"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Zmienne albo funkcje mogą posiadać (zwracać) tylko jedną wartość"); InsertErrorPair(ttmath::err_still_calculating,"Obliczanie..."); InsertErrorPair(ttmath::err_too_big_factorial,"Zbyt duży argument dla funkcji factorial()"); } // for gui messages const char * Languages::GuiMessage(Country country, GuiMsg code) { const char * unk_msg = "unknown"; if( gui_messages_tab.empty() ) InitGuiMessagesTab(); unsigned int cid = static_cast( country ); if( cid >= gui_messages_tab.size() ) return unk_msg; std::map::const_iterator i; i = gui_messages_tab[cid].find( code ); if( i == gui_messages_tab[cid].end() ) return unk_msg; return i->second.c_str(); } const char * Languages::GuiMessage(GuiMsg code) { return GuiMessage(current_country, code); } void Languages::InsertGuiPair(GuiMsg code, const char * message) { if( gui_messages_tab.empty() ) return; gui_messages_tab.back().insert( std::make_pair(code, message) ); } void Languages::InitGuiMessagesTab() { // en gui_messages_tab.push_back( std::map() ); InsertGuiPair(button_ok,"Ok"); InsertGuiPair(button_cancel,"Cancel"); InsertGuiPair(message_box_caption,"TTCalc"); InsertGuiPair(dialog_box_add_variable_caption,"Add a new variable"); InsertGuiPair(dialog_box_edit_variable_caption,"Edit a variable"); InsertGuiPair(dialog_box_add_variable_incorrect_name,"An incorrect name of the variable"); InsertGuiPair(dialog_box_add_variable_incorrect_value,"An incorrect value of the variable"); InsertGuiPair(dialog_box_add_variable_variable_exists,"This variable already exists"); InsertGuiPair(dialog_box_edit_variable_unknown_variable,"There isn't this variable in my table. There's probably an internal error!"); InsertGuiPair(dialog_box_delete_variable_confirm,"Do you want to delete these variables?"); InsertGuiPair(dialog_box_variable_not_all_deleted,"There are some variables which I was not able to delete. Probably an internal error!"); InsertGuiPair(dialog_box_add_function_caption,"Add a new function"); InsertGuiPair(dialog_box_edit_function_caption,"Edit a function"); InsertGuiPair(dialog_box_add_function_function_exists,"This function already exists"); InsertGuiPair(dialog_box_edit_function_unknown_function,"There isn't this function in my table. There's probably an internal error!"); InsertGuiPair(dialog_box_delete_function_confirm,"Do you want to delete these functions?"); InsertGuiPair(dialog_box_function_not_all_deleted,"There are some functions which I was not able to delete. Probably an internal error!"); InsertGuiPair(dialog_box_add_function_incorrect_name,"An incorrect name of the function"); InsertGuiPair(list_variables_header_1,"Name"); InsertGuiPair(list_variables_header_2,"Value"); InsertGuiPair(list_functions_header_1,"Name"); InsertGuiPair(list_functions_header_2,"Param."); InsertGuiPair(list_functions_header_3,"Value"); InsertGuiPair(button_add,"Add"); InsertGuiPair(button_edit,"Edit"); InsertGuiPair(button_delete,"Delete"); InsertGuiPair(button_clear,"C"); InsertGuiPair(tab_standard,"Standard"); InsertGuiPair(tab_variables,"Variables"); InsertGuiPair(tab_functions,"Functions"); InsertGuiPair(tab_precision,"Precision"); InsertGuiPair(tab_display,"Display"); InsertGuiPair(tab_convert,"Convert"); InsertGuiPair(radio_precision_1,"Small - 96 bits for the mantissa, 32 bits for the exponent"); InsertGuiPair(radio_precision_2,"Medium - 192 bits for the mantissa, 64 bits for the exponent"); InsertGuiPair(radio_precision_3,"Big - 288 bits for the mantissa, 96 bits for the exponent"); InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 valid digits (decimal)"); InsertGuiPair(precision_2_info,"(+/-)4.3 e+2776511644261678623, 56 valid digits"); InsertGuiPair(precision_3_info,"(+/-)2.5 e+11925026709067095507636213441, 85 valid digits"); InsertGuiPair(overflow_during_printing,"Overflow during printing"); InsertGuiPair(combo_rounding_none,"None"); InsertGuiPair(combo_rounding_cut_last_digits,"Cut off last non-valid digits"); InsertGuiPair(combo_rounding_integer,"Round to the nearest integer"); InsertGuiPair(combo_rounding_to_number,"to"); InsertGuiPair(combo_rounding_after_comma,"digit(s) after comma"); InsertGuiPair(display_input, "Input"); InsertGuiPair(display_output, "Output"); InsertGuiPair(display_rounding, "Rounding"); InsertGuiPair(display_always_scientific,"Always"); InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:"); InsertGuiPair(display_group_scientific, "Print the result as the scientific value"); InsertGuiPair(convert_type, "Conversion type"); InsertGuiPair(convert_input, "Input"); InsertGuiPair(convert_output, "Output"); InsertGuiPair(convert_dynamic_output, "auto output"); InsertGuiPair(menu_view, "&View"); InsertGuiPair(menu_edit, "&Edit"); InsertGuiPair(menu_help, "&Help"); InsertGuiPair(menu_language, "&Language"); InsertGuiPair(menu_view_new_window, "&New window"); InsertGuiPair(menu_view_normal_view, "No&rmal view"); InsertGuiPair(menu_view_compact_view, "C&ompact view"); InsertGuiPair(menu_view_always_on_top, "&Always on top"); InsertGuiPair(menu_view_lang_english, "&English"); InsertGuiPair(menu_view_lang_polish, "&Polish"); InsertGuiPair(menu_view_close_program, "&Close"); InsertGuiPair(menu_edit_undo, "&Undo"); InsertGuiPair(menu_edit_paste, "&Paste"); InsertGuiPair(menu_edit_copy_result, "&Copy the result"); InsertGuiPair(menu_help_help, "&Help"); InsertGuiPair(menu_help_project_page, "&Project page"); InsertGuiPair(menu_help_about, "&About"); InsertGuiPair(cant_init_calculations, "I could not initialize the module for calculations"); InsertGuiPair(message_box_error_caption,"TTCalc"); InsertGuiPair(cant_create_thread, "I could not create the second thread for calculating"); InsertGuiPair(cant_create_main_window, "I could not create the main window of the application"); InsertGuiPair(cant_init_common_controls,"I could not initialize the common controls (InitCommonControlsEx)"); InsertGuiPair(about_text, "Mathematical calculator TTCalc %d.%d.%d%s%s\r\n" "Author: Tomasz Sowa\r\n" "Contact: t.sowa@slimaczek.pl\r\n" "Licence: (New) BSD licence\r\n" "Project page: http://sourceforge.net/projects/ttcalc\r\n" "Bignum library: TTMath %d.%d.%d%s\r\n" "Programming language: C++\r\n" "Compiler: %s\r\n" "%s" // for upx "\r\n" "TTCalc uses the TTMath bignum library" " which can be found at http://sourceforge.net/projects/ttmath\r\n" "\r\n" #ifdef TTCALC_PORTABLE "This is the portable version of the program TTCalc. In this version " "you can calculate only with one kind of precision (96 bits for the " "mantissa and 32 bits for the exponent) it's about +/-6.9e+646457021.\r\n" "\r\n" #endif "If you have any questions, advices or interesting ideas about" " this program or if you want to join to this project as" " a developer or a programmer feel free to contant with the author." ); InsertGuiPair(about_text_portable_version, " portable version"); InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.00\r\n"); InsertGuiPair(about_box_title, "About"); InsertGuiPair(about_box_button_close, "Close"); InsertGuiPair(unknown_error, "An unknown error has occurred"); InsertGuiPair(cant_find_help, "I can't find any help files"); InsertGuiPair(cant_open_project_page, "I can't open the project webpage"); // pl gui_messages_tab.push_back( std::map() ); InsertGuiPair(button_ok,"Ok"); InsertGuiPair(button_cancel,"Anuluj"); InsertGuiPair(message_box_caption,"TTCalc"); InsertGuiPair(dialog_box_add_variable_caption,"Dodaj nową zmienną"); InsertGuiPair(dialog_box_edit_variable_caption,"Zmień wartość zmiennej"); InsertGuiPair(dialog_box_add_variable_incorrect_name,"Nie prawidłowa nazwa zmiennej"); InsertGuiPair(dialog_box_add_variable_incorrect_value,"Nie prawidłowa wartość zmiennej"); InsertGuiPair(dialog_box_add_variable_variable_exists,"Podana zmienna już istnieje"); InsertGuiPair(dialog_box_edit_variable_unknown_variable,"Podanej zmiennej nie ma w tablicy. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_delete_variable_confirm,"Czy napewno usunąć zaznaczone zmienne?"); InsertGuiPair(dialog_box_variable_not_all_deleted,"Zostało kilka zmiennych których nie można było skasować. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_add_function_caption,"Dodaj nową funkcję"); InsertGuiPair(dialog_box_edit_function_caption,"Zmień wartość funkcji"); InsertGuiPair(dialog_box_add_function_function_exists,"Podana funkcja już istnieje"); InsertGuiPair(dialog_box_edit_function_unknown_function,"Podanej funkcji nie ma w tablicy. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_delete_function_confirm,"Czy napewno usunąć zaznaczone funkcje?"); InsertGuiPair(dialog_box_function_not_all_deleted,"Zostało kilka funkcji których nie można było skasować. Prawdopodobnie błąd wewnętrzny programu."); InsertGuiPair(dialog_box_add_function_incorrect_name,"Nieprawidłowa nazwa funkcji"); InsertGuiPair(list_variables_header_1,"Nazwa"); InsertGuiPair(list_variables_header_2,"Wartość"); InsertGuiPair(list_functions_header_1,"Nazwa"); InsertGuiPair(list_functions_header_2,"Parametry"); InsertGuiPair(list_functions_header_3,"Wartość"); InsertGuiPair(button_add,"Dodaj"); InsertGuiPair(button_edit,"Edytuj"); InsertGuiPair(button_delete,"Usuń"); InsertGuiPair(button_clear,"C"); InsertGuiPair(tab_standard,"Standard"); InsertGuiPair(tab_variables,"Zmienne"); InsertGuiPair(tab_functions,"Funkcje"); InsertGuiPair(tab_precision,"Precyzja"); InsertGuiPair(tab_display,"Wyświetlanie"); InsertGuiPair(tab_convert,"Konwersja"); InsertGuiPair(radio_precision_1,"Mała - 96 bitowa mantysa, 32 bitowy wykładnik"); InsertGuiPair(radio_precision_2,"Średnia - 192 bitowa mantysa, 64 bitowy wykładnik"); InsertGuiPair(radio_precision_3,"Duża - 288 bitowa mantysa, 96 bitowy wykładnik"); InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 cyfr znaczących (w rozwinięciu dziesiętnym)"); InsertGuiPair(precision_2_info,"(+/-)4.3 e+2776511644261678623, 56 cyfr znaczących"); InsertGuiPair(precision_3_info,"(+/-)2.5 e+11925026709067095507636213441, 85 cyfr znaczących"); InsertGuiPair(overflow_during_printing,"Przepełnienie podczas wypisywania"); InsertGuiPair(combo_rounding_none,"bez zaokrąglania"); InsertGuiPair(combo_rounding_cut_last_digits,"skasować nie znaczące zera"); InsertGuiPair(combo_rounding_integer,"do najbliższej całkowitej"); InsertGuiPair(combo_rounding_to_number,"do"); InsertGuiPair(combo_rounding_after_comma,"cyfr(y) po przecinku"); InsertGuiPair(display_input,"Wejście"); InsertGuiPair(display_output,"Wyjście"); InsertGuiPair(display_rounding,"Zaokrąglenie"); InsertGuiPair(display_always_scientific,"Zawsze"); InsertGuiPair(display_not_always_scientific,"Jeśli eksponent jest większy niż:"); InsertGuiPair(display_group_scientific, "Wyświetl wynik w postaci naukowej"); InsertGuiPair(convert_type, "Rodzaj konwersji"); InsertGuiPair(convert_input, "Wejście"); InsertGuiPair(convert_output, "Wyjście"); InsertGuiPair(convert_dynamic_output, "Automatycznie"); InsertGuiPair(menu_view, "&Widok"); InsertGuiPair(menu_edit, "&Edycja"); InsertGuiPair(menu_help, "&Pomoc"); InsertGuiPair(menu_language, "&Język"); InsertGuiPair(menu_view_new_window, "&Nowe okno"); InsertGuiPair(menu_view_normal_view, "Widok no&rmalny"); InsertGuiPair(menu_view_compact_view, "Widok &kompaktowy"); InsertGuiPair(menu_view_always_on_top, "Zawsze na &wierzchu"); InsertGuiPair(menu_view_lang_english, "Język &angielski"); InsertGuiPair(menu_view_lang_polish, "Język &polski"); InsertGuiPair(menu_view_close_program, "&Zamknij"); InsertGuiPair(menu_edit_undo, "&Cofnij"); InsertGuiPair(menu_edit_paste, "&Wklej"); InsertGuiPair(menu_edit_copy_result, "&Kopiuj wynik"); InsertGuiPair(menu_help_help, "&Pomoc"); InsertGuiPair(menu_help_project_page, "&Strona projektu"); InsertGuiPair(menu_help_about, "&O programie"); InsertGuiPair(cant_init_calculations, "Nie udało się zainicjalizować modułu obsługi obliczeń"); InsertGuiPair(message_box_error_caption,"TTCalc"); InsertGuiPair(cant_create_thread, "Nie udało się utworzyć drugiego wątku do obliczeń"); InsertGuiPair(cant_create_main_window, "Nie udało się utworzyć głównego okna aplikacji"); InsertGuiPair(cant_init_common_controls,"Nie udało się zainicjalizować obsługi Common Controls (InitCommonControlsEx)"); InsertGuiPair(about_text, "Kalkulator matematyczny TTCalc %d.%d.%d%s%s\r\n" "Autor: Tomasz Sowa\r\n" "Kontakt: t.sowa@slimaczek.pl\r\n" "Licencja: (New) BSD\r\n" "Strona projektu: http://sourceforge.net/projects/ttcalc\r\n" "Biblioteka dużych liczb: TTMath %d.%d.%d%s\r\n" "Język programowania: C++\r\n" "Kompilator: %s\r\n" "%s" // for upx "\r\n" "Ten program używa biblioteki dużych liczb TTMath" " która jest dostępna na http://sourceforge.net/projects/ttmath\r\n" "\r\n" #ifdef TTCALC_PORTABLE "To jest wersja portable programu TTCalc. W tej wersji możesz dokonywać " "obliczeń jedynie z jednym rodzajem precyzji (96 bitowa mantysa " "oraz 32 bitowy wykładnik) to jest około +/-6.9e+646457021.\r\n" "\r\n" #endif "Jeżeli masz jakieś pytania, rady, ciekawe pomysły dotyczące" " tego programu lub chciałbyś dołączyć jako projektant/programista" " poprostu skontaktuj się z autorem." ); InsertGuiPair(about_text_portable_version, " wersja portable"); InsertGuiPair(about_text_exe_packer, "Paker exe: UPX 3.00\r\n"); InsertGuiPair(about_box_title, "O programie"); InsertGuiPair(about_box_button_close, "Zamknij"); InsertGuiPair(unknown_error, "Nieznany kod błędu"); InsertGuiPair(cant_find_help, "Nie mogę znależć żadnych plików pomocy"); InsertGuiPair(cant_open_project_page, "Nie mogę otworzyć strony projektu"); } void Languages::ConvertingAddType(const char * name) { if( converting_type.empty() ) return; ConvType temp; temp.name = name; converting_type.back().push_back(temp); } void Languages::ConvertingAddUnit(const char * name, double v) { if( converting_type.empty() || converting_type.back().empty() || converting_unit.empty() ) return; ConvUnit temp; temp.name = name; temp.type = static_cast(converting_type.back().size()-1); temp.value = v; converting_unit.back().push_back(temp); } void Languages::InitConverting() { // en converting_type.push_back( std::vector() ); converting_unit.push_back( std::vector() ); ConvertingAddType("none"); ConvertingAddType("length"); ConvertingAddUnit("metre", 1); ConvertingAddUnit("mile", 1600); ConvertingAddType("area"); ConvertingAddUnit("are", 10); ConvertingAddUnit("square metre", 1); // pl // the 'value' param we're using only from the english converting_type.push_back( std::vector() ); converting_unit.push_back( std::vector() ); ConvertingAddType("brak"); ConvertingAddType("długość"); ConvertingAddUnit("metr"); ConvertingAddUnit("mila"); ConvertingAddType("obszar"); ConvertingAddUnit("ar"); ConvertingAddUnit("metr kwadratowy"); } const char * Languages::ConvertingType(Country country, int id) { const char * unk_err = "unknown"; if( converting_type.empty() ) InitConverting(); unsigned int cid = static_cast( country ); if( cid >= converting_type.size() ) return unk_err; if( id< 0 || id >= static_cast(converting_type[cid].size()) ) return unk_err; return converting_type[cid][id].name.c_str(); } const char * Languages::ConvertingUnit(Country country, int id) { const char * unk_err = "unknown"; if( converting_unit.empty() ) InitConverting(); unsigned int cid = static_cast( country ); if( cid >= converting_unit.size() ) return unk_err; if( id < 0 || id >= static_cast(converting_unit[cid].size()) ) return unk_err; return converting_unit[cid][id].name.c_str(); } const char * Languages::ConvertingType(int id) { return ConvertingType(current_country, id); } const char * Languages::ConvertingUnit(int id) { return ConvertingUnit(current_country, id); } int Languages::ConvertingTypeSize(Country country) { if( converting_type.empty() ) InitConverting(); unsigned int cid = static_cast( country ); if( cid >= converting_type.size() ) return 0; return static_cast(converting_type[cid].size()); } int Languages::ConvertingUnitSize(Country country) { if( converting_unit.empty() ) InitConverting(); unsigned int cid = static_cast( country ); if( cid >= converting_unit.size() ) return 0; return static_cast(converting_unit[cid].size()); } int Languages::ConvertingTypeSize() { return ConvertingTypeSize(current_country); } int Languages::ConvertingUnitSize() { return ConvertingUnitSize(current_country); } int Languages::ConvertingUnitType(Country country, int id) { if( converting_unit.empty() ) InitConverting(); unsigned int cid = static_cast( country ); if( cid >= converting_unit.size() ) return -1; if( id >= static_cast(converting_unit[cid].size()) ) return -1; return converting_unit[cid][id].type; } int Languages::ConvertingUnitType(int id) { return ConvertingUnitType(current_country, id); } // value is taken only from english double Languages::ConvertingUnitValue(int id) { if( converting_unit.empty() ) InitConverting(); if( id >= static_cast(converting_unit[0].size()) ) return -1.0; return converting_unit[0][id].value; }