Boost.Locale
|
Holder and parser for locale names/identifiers. More...
#include <boost/locale/util/locale_data.hpp>
Public Member Functions | |
locale_data () | |
Default to C locale with US-ASCII encoding. | |
locale_data (const std::string &locale_name) | |
const std::string & | language () const |
Return language (usually 2 lowercase letters, i.e. ISO-639 or 'C') | |
const std::string & | country () const |
Return country (usually 2 uppercase letters, i.e. ISO-3166) | |
const std::string & | encoding () const |
Return encoding/codeset, e.g. ISO8859-1 or UTF-8. | |
locale_data & | encoding (std::string new_encoding, bool uppercase=true) |
const std::string & | variant () const |
Return variant/modifier, e.g. euro or stroke. | |
bool | is_utf8 () const |
Return iff the encoding is UTF-8. | |
bool | parse (const std::string &locale_name) |
std::string | to_string () const |
Holder and parser for locale names/identifiers.
|
explicit |
locale_data & boost::locale::util::locale_data::encoding | ( | std::string | new_encoding, |
bool | uppercase = true |
||
) |
Set encoding, will be made uppercase by default as-if it was parsed Returns *this
for chaining
bool boost::locale::util::locale_data::parse | ( | const std::string & | locale_name | ) |
Parse a locale identifier of the form [language[_territory][.codeset][@modifier]]
Allows a dash as the delimiter: [language-territory]
Return true if the identifier is valid:
language
is given and consists of ASCII lettersterritory
, if given, consists of ASCII letters_
, -
, .
, @
) is not empty Otherwise parsing is aborted. Valid values already parsed stay set, other are defaulted. std::string boost::locale::util::locale_data::to_string | ( | ) | const |
Get a representation in the form [language[_territory][.codeset][@modifier]]
codeset is omitted if it is US-ASCII