RDK Documentation (Open Sourced RDK Components)
iso639map.cpp File Reference

ISO639 is a standard with representation of names for languages. More...

#include "iso639map.h"
#include <cstdlib>
#include <string.h>
#include <ctype.h>
Include dependency graph for iso639map.cpp:

Go to the source code of this file.

Macros

#define ISO639_BTMAP_ENTRY_SIZE   (3+3+1)
 
#define ISO639_BTMAP_ENTRY_COUNT   20
 
#define ISO639_23MAP_ENTRY_SIZE   (2+3+1)
 
#define ISO639_23MAP_ENTRY_COUNT   (204-ISO639_BTMAP_ENTRY_COUNT)
 

Functions

static int myCompare23 (const void *pkey, const void *pelem)
 
static int myCompareBT (const void *pkey, const void *pelem)
 
static const char * MapISO639_BibliographicToTerminology (const char *language3)
 map "bibliographic" language code to corresponding "terminology" language code More...
 
static void MapISO639_TerminologyToBibliographic (char *language3)
 
static void ConvertLanguage2to3 (char lang[], bool useTerminologyVariant)
 convert 2-character ISO639-1 code, map to 3-character ISO639-2 code More...
 
static void ConvertLanguage3to2 (char lang[])
 convert 3-character ISO639-2 code, map to 2-character ISO639-1 code More...
 
static void ConvertToLowerCase (char lang[])
 Convert lang code to contain only lower case chars. More...
 
void iso639map_NormalizeLanguageCode (char lang[], LangCodePreference langCodePreference)
 

Variables

static const char mISO639_2_3_pairs [(204- 20)][(2+3+1)]
 
static const char mBibliographicTerminologyPairs [20][(3+3+1)]
 

yes

ISO639 is a standard with representation of names for languages.

Definition in file iso639map.cpp.

Function Documentation

◆ myCompare23()

static int myCompare23 ( const void *  pkey,
const void *  pelem 
)
static
Parameters
pkeypointer to two-character ISO639-1 language key
pelempointer to mISO639_2_3_pairs record
Return values
negativeiff pkey is before pelem
positiveiff pkey is after pelem
zeroiff pkey matches pelem

Definition at line 268 of file iso639map.cpp.

◆ myCompareBT()

static int myCompareBT ( const void *  pkey,
const void *  pelem 
)
static
Parameters
pkeypointer to three-character ISO639-2 language key
pelempointer to mBibliographicTerminologyPairs record
Return values
negativeiff pkey is before pelem
positiveiff pkey is after pelem
zeroiff pkey matches pelem

Definition at line 286 of file iso639map.cpp.

◆ MapISO639_BibliographicToTerminology()

static const char* MapISO639_BibliographicToTerminology ( const char *  language3)
static

map "bibliographic" language code to corresponding "terminology" language code

Parameters
language3three-character ISO639-2 language key
Return values
correspondingterminology code if language3 is a bibliographic code
echolanguage3 if not mapped

Definition at line 308 of file iso639map.cpp.

◆ ConvertLanguage2to3()

static void ConvertLanguage2to3 ( char  lang[],
bool  useTerminologyVariant 
)
static

convert 2-character ISO639-1 code, map to 3-character ISO639-2 code

Parameters
langstring to convert (if not already 3 character Terminology code

Definition at line 344 of file iso639map.cpp.

◆ ConvertLanguage3to2()

static void ConvertLanguage3to2 ( char  lang[])
static

convert 3-character ISO639-2 code, map to 2-character ISO639-1 code

Parameters
langstring to convert (if not already 2 character code

Definition at line 393 of file iso639map.cpp.

◆ ConvertToLowerCase()

static void ConvertToLowerCase ( char  lang[])
static

Convert lang code to contain only lower case chars.

Parameters
langstring to convert

Definition at line 420 of file iso639map.cpp.

Variable Documentation

◆ mISO639_2_3_pairs

const char mISO639_2_3_pairs[(204- 20)][(2+3+1)]
static

sorted list of packed iso639-1, iso639-2 pairs delimited by a nul terminator, allowing pointer to the iso632-2 entry as valid c string entries sorted by the iso639-1 language code to facilitate binary search

Definition at line 41 of file iso639map.cpp.

◆ mBibliographicTerminologyPairs

const char mBibliographicTerminologyPairs[20][(3+3+1)]
static
Initial value:
=
{
"alb" "sqi",
"arm" "hye",
"baq" "eus",
"bur" "mya",
"chi" "zho",
"cze" "ces",
"dut" "nld",
"fre" "fra",
"geo" "kat",
"ger" "deu",
"gre" "ell",
"ice" "isl",
"mac" "mkd",
"mao" "mri",
"may" "msa",
"per" "fas",
"rum" "ron",
"slo" "slk",
"tib" "bod",
"wel" "cym",
}

sorted list of packed iso639-2 bibliographic, terminology language code pairs delimited by a nul terminator, allowing pointer to the terminology entry as valid c string entries sorted by the bibliographic language code to facilitate binary search

Used to normalize use of the 'terminology' version of iso639-2 langauge codes.

Definition at line 236 of file iso639map.cpp.