![]() |
Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
|
#include <LangCodeExpander.h>
Public Types | |
enum | LANGFORMATS { ISO_639_1 , ISO_639_2 , ENGLISH_NAME } |
Public Member Functions | |
CLangCodeExpander () | |
~CLangCodeExpander () | |
void | LoadUserCodes (const TiXmlElement *pRootElement) |
void | Clear () |
bool | Lookup (const std::string &code, std::string &desc) |
bool | Lookup (const int code, std::string &desc) |
bool | CompareFullLanguageNames (const std::string &lang1, const std::string &lang2) |
Determines if two english language names represent the same language. More... | |
bool | CompareISO639Codes (const std::string &code1, const std::string &code2) |
Determines if two languages given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B codes represent the same language. More... | |
bool | ConvertToISO6391 (const std::string &lang, std::string &code) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 2-Char (ISO 639-1) code. More... | |
std::string | ConvertToISO6392B (const std::string &lang) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/B code. More... | |
bool | ConvertToISO6392B (const std::string &strCharCode, std::string &strISO6392B, bool checkWin32Locales=false) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code. More... | |
bool | ConvertToISO6392T (const std::string &strCharCode, std::string &strISO6392T, bool checkWin32Locales=false) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code. More... | |
std::string | ConvertToISO6392T (const std::string &lang) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code. More... | |
std::vector< std::string > | GetLanguageNames (LANGFORMATS format=ISO_639_1, bool customNames=false) |
Static Public Member Functions | |
static bool | ConvertISO6391ToISO6392B (const std::string &strISO6391, std::string &strISO6392B, bool checkWin32Locales=false) |
Converts a language given as 2-Char (ISO 639-1) to a 3-Char (ISO 639-2/T) code. More... | |
Protected Types | |
typedef std::map< std::string, std::string > | STRINGLOOKUPTABLE |
Protected Member Functions | |
bool | LookupInUserMap (const std::string &code, std::string &desc) |
bool | ReverseLookup (const std::string &desc, std::string &code) |
Looks up the ISO 639-1, ISO 639-2/T, or ISO 639-2/B, whichever it finds first, code of the given english language name. More... | |
bool | LookupUserCode (const std::string &desc, std::string &userCode) |
Looks up the user defined code of the given code or language name. More... | |
Static Protected Member Functions | |
static void | CodeToString (long code, std::string &ret) |
Converts a language code given as a long, see MAKECODE(a, b, c, d) to its string representation. More... | |
static bool | LookupInISO639Tables (const std::string &code, std::string &desc) |
Protected Attributes | |
STRINGLOOKUPTABLE | m_mapUser |
|
protected |
|
default |
|
default |
void CLangCodeExpander::Clear | ( | ) |
|
staticprotected |
Converts a language code given as a long, see MAKECODE(a, b, c, d) to its string representation.
[in] | code | The language code given as a long, see MAKECODE(a, b, c, d). |
[out] | ret | The string representation of the given language code code. |
bool CLangCodeExpander::CompareFullLanguageNames | ( | const std::string & | lang1, |
const std::string & | lang2 | ||
) |
Determines if two english language names represent the same language.
[in] | lang1 | The first language string to compare given as english language name. |
[in] | lang2 | The second language string to compare given as english language name. |
bool CLangCodeExpander::CompareISO639Codes | ( | const std::string & | code1, |
const std::string & | code2 | ||
) |
Determines if two languages given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B codes represent the same language.
[in] | code1 | The first language to compare given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B code. |
[in] | code2 | The second language to compare given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B code. |
|
static |
Converts a language given as 2-Char (ISO 639-1) to a 3-Char (ISO 639-2/T) code.
[in] | strISO6391 | The language that should be converted. |
[out] | strISO6392B | The 3-Char (ISO 639-2/B) language code of the given language strISO6391. |
[in] | checkWin32Locales | Whether to also check WIN32 specific language codes. |
bool CLangCodeExpander::ConvertToISO6391 | ( | const std::string & | lang, |
std::string & | code | ||
) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 2-Char (ISO 639-1) code.
[out] | code | The 2-Char language code of the given language lang. |
[in] | lang | The language that should be converted. |
std::string CLangCodeExpander::ConvertToISO6392B | ( | const std::string & | lang | ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/B code.
[in] | lang | The language that should be converted. |
bool CLangCodeExpander::ConvertToISO6392B | ( | const std::string & | strCharCode, |
std::string & | strISO6392B, | ||
bool | checkWin32Locales = false |
||
) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code.
[in] | strCharCode | The language that should be converted. |
[out] | strISO6392B | The 3-Char (ISO 639-2/B) language code of the given language strISO6391. |
[in] | checkWin32Locales | Whether to also check WIN32 specific language codes. |
std::string CLangCodeExpander::ConvertToISO6392T | ( | const std::string & | lang | ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code.
[in] | lang | The language that should be converted. |
bool CLangCodeExpander::ConvertToISO6392T | ( | const std::string & | strCharCode, |
std::string & | strISO6392T, | ||
bool | checkWin32Locales = false |
||
) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code.
[in] | strCharCode | The language that should be converted. |
[out] | strISO6392T | The 3-Char (ISO 639-2/T) language code of the given language strISO6391. |
[in] | checkWin32Locales | Whether to also check WIN32 specific language codes. |
std::vector< std::string > CLangCodeExpander::GetLanguageNames | ( | LANGFORMATS | format = ISO_639_1 , |
bool | customNames = false |
||
) |
void CLangCodeExpander::LoadUserCodes | ( | const TiXmlElement * | pRootElement | ) |
bool CLangCodeExpander::Lookup | ( | const int | code, |
std::string & | desc | ||
) |
bool CLangCodeExpander::Lookup | ( | const std::string & | code, |
std::string & | desc | ||
) |
|
staticprotected |
|
protected |
|
protected |
Looks up the user defined code of the given code or language name.
[in] | desc | The language code or name that should be converted. |
[out] | userCode | The user defined language code of the given language desc. |
|
protected |
Looks up the ISO 639-1, ISO 639-2/T, or ISO 639-2/B, whichever it finds first, code of the given english language name.
[in] | desc | The english language name for which a code is looked for. |
[out] | code | The ISO 639-1, ISO 639-2/T, or ISO 639-2/B code of the given language desc. |
|
protected |