OKlib::Messages::LanguageName Class Reference

Functor to translate language names into language constants. More...

#include <LanguageNames.hpp>

Inheritance diagram for OKlib::Messages::LanguageName:

List of all members.


struct  PairFunction
struct  UninterpretableLanguageName

Public Member Functions

language_type operator() (const char *const name) const

Detailed Description

Functor to translate language names into language constants.

::OKlib::Messages::LanguageName(name), where name is a C-string, yields a value of type OKlib::Messages::Languages (an enumeration type), while throwing an exception of type LanguageName::UninterpretableLanguageName in case name doesn't refer to an existing language.

The available names are exactly the names of the enumerated constants in the enumeration type OKlib::Messages::Languages (so LanguageName(name) is just the value of name as C++ constant), which in turn are exactly the strings given by the macro OKLIB_LANGUAGES (in OKlib/Programming/Messages/Languages.hpp). Since the language names are made available by the array OKlib::Messages::Locales, class LanguageName is nothing than a find-wrapper for this array (enabling faster access than by just linearly searching through this array).

For example LanguageName("en_GB") == ::OKlib::Messages::en_GB == ::OKlib::Messages::Languages(0).

Definition at line 48 of file LanguageNames.hpp.

Member Function Documentation

language_type OKlib::Messages::LanguageName::operator() ( const char *const  name) const [inline]

Definition at line 69 of file LanguageNames.hpp.

References end.

The documentation for this class was generated from the following file: