Boost.Locale
boost::locale::util::locale_data Class Reference

Holder and parser for locale names/identifiers. More...

#include <boost/locale/util/locale_data.hpp>

Public Member Functions

 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.
 
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)
 Parse a locale identifier of the form [language[_territory][.codeset][@modifier]] Allows a dash as the delimiter: [language-territory] More...
 
std::string to_string () const
 

Detailed Description

Holder and parser for locale names/identifiers.

Member Function Documentation

◆ parse()

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 letters
  • territory, if given, consists of ASCII letters
  • Any field started by a delimiter (_, -, ., @) is not empty Otherwise parsing is aborted. Valid values already parsed stay set, other are defaulted.

◆ to_string()

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


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