libzypp  13.10.6
zypp::Locale Class Reference

#include <Locale.h>

Classes

struct  Impl
 Locale implementation. More...
 

Public Member Functions

 Locale ()
 Default ctor. More...
 
 Locale (IdString code_r)
 Ctor taking a string. More...
 
 Locale (const std::string &code_r)
 
 Locale (const char *code_r)
 
 Locale (const LanguageCode &language_r, const CountryCode &country_r=CountryCode())
 Ctor taking LanguageCode and optional CountryCode. More...
 
 ~Locale ()
 Dtor. More...
 
const LanguageCodelanguage () const
 
const CountryCodecountry () const
 
std::string code () const
 Return the locale code. More...
 
std::string name () const
 Return the name made of language and country name. More...
 
Locale fallback () const
 Return a fallback locale for this locale, when giving up, returns empty Locale() More...
 

Static Public Member Functions

static Locale bestMatch (const LocaleSet &avLocales_r, const Locale &requested_r=Locale())
 Return the best match for Locale requested_r within the available avLocales_r. More...
 

Static Public Attributes

Locale constants.
static const Locale noCode
 No or empty code. More...
 

Private Attributes

RW_pointer< Impl_pimpl
 Pointer to implementation. More...
 

Friends

std::ostream & operator<< (std::ostream &str, const Locale &obj)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const Locale &obj)
 
template<>
bool operator() (const zypp::Locale &lhs, const zypp::Locale &rhs) const
 
bool operator== (const Locale &lhs, const Locale &rhs)
 Comparison based on string value. More...
 
bool operator== (const std::string &lhs, const Locale &rhs)
 
bool operator== (const Locale &lhs, const std::string &rhs)
 
bool operator!= (const Locale &lhs, const Locale &rhs)
 
bool operator!= (const std::string &lhs, const Locale &rhs)
 
bool operator!= (const Locale &lhs, const std::string &rhs)
 

Detailed Description

Todo:
migrate to IdString

Definition at line 38 of file Locale.h.

Constructor & Destructor Documentation

zypp::Locale::Locale ( )

Default ctor.

Definition at line 137 of file Locale.cc.

zypp::Locale::Locale ( IdString  code_r)
explicit

Ctor taking a string.

Definition at line 146 of file Locale.cc.

zypp::Locale::Locale ( const std::string &  code_r)
explicit

Definition at line 155 of file Locale.cc.

zypp::Locale::Locale ( const char *  code_r)
explicit

Definition at line 164 of file Locale.cc.

zypp::Locale::Locale ( const LanguageCode language_r,
const CountryCode country_r = CountryCode() 
)

Ctor taking LanguageCode and optional CountryCode.

Definition at line 173 of file Locale.cc.

zypp::Locale::~Locale ( )

Dtor.

Definition at line 183 of file Locale.cc.

Member Function Documentation

const LanguageCode & zypp::Locale::language ( ) const

Definition at line 191 of file Locale.cc.

const CountryCode & zypp::Locale::country ( ) const

Definition at line 199 of file Locale.cc.

std::string zypp::Locale::code ( ) const

Return the locale code.

Definition at line 207 of file Locale.cc.

std::string zypp::Locale::name ( ) const

Return the name made of language and country name.

Definition at line 215 of file Locale.cc.

Locale zypp::Locale::fallback ( ) const

Return a fallback locale for this locale, when giving up, returns empty Locale()

Definition at line 223 of file Locale.cc.

Locale zypp::Locale::bestMatch ( const LocaleSet avLocales_r,
const Locale requested_r = Locale() 
)
static

Return the best match for Locale requested_r within the available avLocales_r.

If requested_r is nor specified or equals Locale::noCode, ZConfig::textLocale is assumed.

If neither requested_r nor any of it's fallback locales are available, Locale::noCode is returned.

Definition at line 229 of file Locale.cc.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  str,
const Locale obj 
)
friend
std::ostream & operator<< ( std::ostream &  str,
const Locale obj 
)
related

Stream output

Definition at line 108 of file Locale.h.

bool operator== ( const Locale lhs,
const Locale rhs 
)
related

Comparison based on string value.

Definition at line 114 of file Locale.h.

bool operator== ( const std::string &  lhs,
const Locale rhs 
)
related

Definition at line 118 of file Locale.h.

bool operator== ( const Locale lhs,
const std::string &  rhs 
)
related

Definition at line 122 of file Locale.h.

bool operator!= ( const Locale lhs,
const Locale rhs 
)
related

Definition at line 127 of file Locale.h.

bool operator!= ( const std::string &  lhs,
const Locale rhs 
)
related

Definition at line 131 of file Locale.h.

bool operator!= ( const Locale lhs,
const std::string &  rhs 
)
related

Definition at line 135 of file Locale.h.

bool operator() ( const zypp::Locale lhs,
const zypp::Locale rhs 
) const
related

Default order for std::container based on code string value.

Definition at line 158 of file Locale.h.

Member Data Documentation

const Locale zypp::Locale::noCode
static

No or empty code.

Definition at line 71 of file Locale.h.

RW_pointer<Impl> zypp::Locale::_pimpl
private

Pointer to implementation.

Definition at line 103 of file Locale.h.


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