zypp::Locale Class Reference

#include <Locale.h>

List of all members.

Classes

struct  Impl
 Locale implementation. More...

Public Member Functions

 Locale ()
 Default ctor.
 Locale (IdString code_r)
 Ctor taking a string.
 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.
 ~Locale ()
 Dtor.
const LanguageCodelanguage () const
const CountryCodecountry () const
std::string code () const
 Return the locale code.
std::string name () const
 Return the name made of language and country name.
Locale fallback () const
 Return a fallback locale for this locale, when giving up, returns empty Locale().

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.

Static Public Attributes

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

Private Attributes

RW_pointer< Impl_pimpl
 Pointer to implementation.

Friends

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

Related Functions

(Note that these are not member functions.)

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.
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.

Referenced by zypp::Locale::Impl::fallback().

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.

References _pimpl.

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

Definition at line 199 of file Locale.cc.

References _pimpl.

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

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

Return the name made of language and country name.

Definition at line 215 of file Locale.cc.

References _pimpl.

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.

References _pimpl.

Referenced by zypp::sat::detail::_locale_hack(), zypp::repo::susetags::Downloader::download(), zypp::sat::Solvable::lookupStrAttribute(), and zypp::sat::detail::PoolImpl::setTextLocale().

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.

References zypp::applydeltarpm::check(), zypp::ZConfig::instance(), and noCode.

Referenced by zypp::RepoInfo::getLicense().


Friends And Related Function Documentation

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

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.

References code().

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

Definition at line 118 of file Locale.h.

References code().

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

Definition at line 122 of file Locale.h.

References code().

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.

References code().


Member Data Documentation

const Locale zypp::Locale::noCode [static]

Pointer to implementation.

Definition at line 103 of file Locale.h.

Referenced by code(), country(), fallback(), language(), and name().


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

doxygen