Boost.Locale
boost::locale Namespace Reference

This is the main namespace that encloses all localization classes. More...

Namespaces

namespace  as
 This namespace includes all manipulators that can be used on IO streams.
 
namespace  boundary
 This namespace contains all operations required for boundary analysis of text.
 
namespace  conv
 Namespace that contains all functions related to character set conversion.
 
namespace  flags
 This namespace holds additional formatting flags that can be set using ios_info.
 
namespace  gnu_gettext
 This namespace holds classes that provide GNU Gettext message catalogs support.
 
namespace  period
 Namespace that contains various types for manipulation with dates.
 
namespace  time_zone
 namespace that holds functions for operating with global time zone
 
namespace  utf
 Namespace that holds basic operations on UTF encoded sequences.
 
namespace  util
 This namespace provides various utility function useful for Boost.Locale's backends implementations.
 

Classes

class  abstract_calendar
 
class  basic_format
 a printf like class that allows type-safe and locale aware message formatting More...
 
class  basic_message
 This class represents a message that can be converted to a specific locale message. More...
 
class  calendar
 this class provides an access to general calendar information. More...
 
class  calendar_facet
 the facet that generates calendar for specific locale More...
 
class  collator
 Collation facet. More...
 
struct  comparator
 This class can be used in STL algorithms and containers for comparison of strings with a level other than primary. More...
 
class  converter
 The facet that implements text manipulation. More...
 
class  converter_base
 This class provides base flags for text manipulation. It is used as base for converter facet. More...
 
class  date_time
 this class represents a date time and allows to perform various operation according to the locale settings. More...
 
class  date_time_duration
 This class represents a period: a pair of two date_time objects. More...
 
class  date_time_error
 This error is thrown in case of invalid state that occurred. More...
 
struct  date_time_period
 This class represents a pair of period_type and the integer values that describes its amount. For example 3 days or 4 years. More...
 
class  date_time_period_set
 This class represents a set of periods. More...
 
class  generator
 the major class used for locale generation More...
 
class  generic_codecvt
 Generic codecvt facet for various stateless encodings to UTF-16 and UTF-32 using wchar_t, char32_t and char16_t. More...
 
class  generic_codecvt< char, CodecvtImpl, 1 >
 
class  generic_codecvt< CharType, CodecvtImpl, 2 >
 UTF-16 to/from narrow char codecvt facet to use with char16_t or wchar_t on Windows. More...
 
class  generic_codecvt< CharType, CodecvtImpl, 4 >
 UTF-32 to/from narrow char codecvt facet to use with char32_t or wchar_t on POSIX platforms. More...
 
class  generic_codecvt_base
 A base class that used to define constants for generic_codecvt. More...
 
class  hold_ptr
 a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the pointer itself (unlike an ordinary pointer). More...
 
class  info
 a facet that holds general information about locale More...
 
class  ios_info
 This class holds external data beyond existing fmtflags that std::ios_base holds. More...
 
class  localization_backend
 this class represents a localization backend that can be used for localizing your application. More...
 
class  localization_backend_manager
 Localization backend manager is a class that holds various backend and allows creation of their combination or selection. More...
 
class  message_format
 This facet provides message formatting abilities. More...
 
struct  posix_time
 
class  utf8_codecvt
 Generic utf8 codecvt facet, it allows to convert UTF-8 strings to UTF-16 and UTF-32 using wchar_t, char32_t and char16_t. More...
 

Typedefs

typedef basic_format< char > format
 Definition of char based format.
 
typedef basic_format< wchar_t > wformat
 Definition of wchar_t based format.
 
typedef basic_format< char8_t > u8format
 Definition of char8_t based format.
 
typedef basic_format< char16_t > u16format
 Definition of char16_t based format.
 
typedef basic_format< char32_t > u32format
 Definition of char32_t based format.
 
using count_type = long long
 Type used for the count/n argument to the translation functions choosing between singular and plural forms.
 
typedef basic_message< char > message
 Convenience typedef for char.
 
typedef basic_message< wchar_t > wmessage
 Convenience typedef for wchar_t.
 
typedef basic_message< char8_t > u8message
 Convenience typedef for char8_t.
 
typedef basic_message< char16_t > u16message
 Convenience typedef for char16_t.
 
typedef basic_message< char32_t > u32message
 Convenience typedef for char32_t.
 

Enumerations

enum class  collate_level {
  collate_level::primary = 0 , collate_level::secondary = 1 , collate_level::tertiary = 2 , collate_level::quaternary = 3 ,
  collate_level::identical = 4
}
 Unicode collation level types. More...
 
enum  norm_type {
  norm_nfd , norm_nfc , norm_nfkd , norm_nfkc ,
  norm_default = norm_nfc
}
 The type that defined normalization form More...
 
enum class  char_facet_t : uint32_t {
  nochar = 0 , char_f = 1 << 0 , wchar_f = 1 << 1 , char16_f = 1 << 3 ,
  char32_f = 1 << 4
}
 
enum class  category_t : uint32_t {
  convert = 1 << 0 , collation = 1 << 1 , formatting = 1 << 2 , parsing = 1 << 3 ,
  message = 1 << 4 , codepage = 1 << 5 , boundary = 1 << 6 , calendar = 1 << 16 ,
  information = 1 << 17
}
 

Functions

class BOOST_DEPRECATED ("Use collate_level") collator_base
 
template<typename CharType >
std::basic_string< CharType > normalize (const CharType *begin, const CharType *end, norm_type n=norm_default, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > normalize (const std::basic_string< CharType > &str, norm_type n=norm_default, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > normalize (const CharType *str, norm_type n=norm_default, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_upper (const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_upper (const std::basic_string< CharType > &str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_upper (const CharType *str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_lower (const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_lower (const std::basic_string< CharType > &str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_lower (const CharType *str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_title (const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_title (const std::basic_string< CharType > &str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > to_title (const CharType *str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > fold_case (const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > fold_case (const std::basic_string< CharType > &str, const std::locale &loc=std::locale())
 
template<typename CharType >
std::basic_string< CharType > fold_case (const CharType *str, const std::locale &loc=std::locale())
 
date_time_period_set operator+ (const date_time_period_set &a, const date_time_period_set &b)
 Append two periods sets. Note this operator is not commutative.
 
date_time_period_set operator- (const date_time_period_set &a, const date_time_period_set &b)
 Append two period sets when all periods of set change their sign.
 
void swap (date_time &left, date_time &right) noexcept
 
template<typename CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &out, const date_time &t)
 
template<typename CharType >
std::basic_istream< CharType > & operator>> (std::basic_istream< CharType > &in, date_time &t)
 
date_time_duration operator- (const date_time &later, const date_time &earlier)
 
template<typename CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &out, const basic_format< CharType > &fmt)
 
typedef BOOST_DEPRECATED ("Use char_facet_t") char_facet_t character_facet_type
 
typedef BOOST_DEPRECATED ("Use category_t") category_t locale_category_type
 
constexpr char_facet_t operator| (const char_facet_t lhs, const char_facet_t rhs)
 
constexpr char_facet_t operator^ (const char_facet_t lhs, const char_facet_t rhs)
 
constexpr bool operator& (const char_facet_t lhs, const char_facet_t rhs)
 
BOOST_CXX14_CONSTEXPR char_facet_toperator++ (char_facet_t &v)
 
constexpr category_t operator| (const category_t lhs, const category_t rhs)
 
constexpr category_t operator^ (const category_t lhs, const category_t rhs)
 
constexpr bool operator& (const category_t lhs, const category_t rhs)
 
BOOST_CXX14_CONSTEXPR category_toperator++ (category_t &v)
 
template<typename CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &out, const basic_message< CharType > &msg)
 Translate message msg and write it to stream.
 
Indirect message translation function family

template<typename CharType >
basic_message< CharType > translate (const CharType *msg)
 Translate a message, msg is not copied.
 
template<typename CharType >
basic_message< CharType > translate (const CharType *context, const CharType *msg)
 Translate a message in context, msg and context are not copied.
 
template<typename CharType >
basic_message< CharType > translate (const CharType *single, const CharType *plural, count_type n)
 Translate a plural message form, single and plural are not copied.
 
template<typename CharType >
basic_message< CharType > translate (const CharType *context, const CharType *single, const CharType *plural, count_type n)
 Translate a plural message from in context, context, single and plural are not copied.
 
template<typename CharType >
basic_message< CharType > translate (const std::basic_string< CharType > &msg)
 Translate a message, msg is copied.
 
template<typename CharType >
basic_message< CharType > translate (const std::basic_string< CharType > &context, const std::basic_string< CharType > &msg)
 Translate a message in context,context and msg is copied.
 
template<typename CharType >
basic_message< CharType > translate (const std::basic_string< CharType > &context, const std::basic_string< CharType > &single, const std::basic_string< CharType > &plural, count_type n)
 Translate a plural message form in context, context, single and plural are copied.
 
template<typename CharType >
basic_message< CharType > translate (const std::basic_string< CharType > &single, const std::basic_string< CharType > &plural, count_type n)
 Translate a plural message form, single and plural are copied.
 
Direct message translation functions family

template<typename CharType >
std::basic_string< CharType > gettext (const CharType *id, const std::locale &loc=std::locale())
 Translate message id according to locale loc.
 
template<typename CharType >
std::basic_string< CharType > ngettext (const CharType *s, const CharType *p, count_type n, const std::locale &loc=std::locale())
 Translate plural form according to locale loc.
 
template<typename CharType >
std::basic_string< CharType > dgettext (const char *domain, const CharType *id, const std::locale &loc=std::locale())
 Translate message id according to locale loc in domain domain.
 
template<typename CharType >
std::basic_string< CharType > dngettext (const char *domain, const CharType *s, const CharType *p, count_type n, const std::locale &loc=std::locale())
 Translate plural form according to locale loc in domain domain.
 
template<typename CharType >
std::basic_string< CharType > pgettext (const CharType *context, const CharType *id, const std::locale &loc=std::locale())
 Translate message id according to locale loc in context context.
 
template<typename CharType >
std::basic_string< CharType > npgettext (const CharType *context, const CharType *s, const CharType *p, count_type n, const std::locale &loc=std::locale())
 Translate plural form according to locale loc in context context.
 
template<typename CharType >
std::basic_string< CharType > dpgettext (const char *domain, const CharType *context, const CharType *id, const std::locale &loc=std::locale())
 Translate message id according to locale loc in domain domain in context context.
 
template<typename CharType >
std::basic_string< CharType > dnpgettext (const char *domain, const CharType *context, const CharType *s, const CharType *p, count_type n, const std::locale &loc=std::locale())
 Translate plural form according to locale loc in domain domain in context context.
 

Variables

constexpr char_facet_t character_facet_first = char_facet_t::char_f
 First facet specific for character type.
 
constexpr char_facet_t character_facet_last
 Last facet specific for character type. More...
 
constexpr char_facet_t all_characters = char_facet_t(0xFFFFFFFFu)
 Special mask – generate all.
 
constexpr category_t per_character_facet_first = category_t::convert
 First facet specific for character.
 
constexpr category_t per_character_facet_last = category_t::boundary
 Last facet specific for character.
 
constexpr category_t non_character_facet_first = category_t::calendar
 First character independent facet.
 
constexpr category_t non_character_facet_last = category_t::information
 Last character independent facet.
 
constexpr category_t category_first = category_t::convert
 First category facet.
 
constexpr category_t category_last = category_t::information
 Last category facet.
 
constexpr category_t all_categories = category_t(0xFFFFFFFFu)
 Generate all of them.
 

Detailed Description

This is the main namespace that encloses all localization classes.

Enumeration Type Documentation

◆ category_t

enum class boost::locale::category_t : uint32_t
strong

Type used for more fine grained generation of facets

Supports bitwise OR and bitwise AND (the latter returning if the type is set)

Enumerator
convert 

Generate conversion facets.

collation 

Generate collation facets.

formatting 

Generate numbers, currency, date-time formatting facets.

parsing 

Generate numbers, currency, date-time formatting facets.

message 

Generate message facets.

codepage 

Generate character set conversion facets (derived from std::codecvt)

boundary 

Generate boundary analysis facet.

calendar 

Generate boundary analysis facet.

information 

Generate general locale information facet.

◆ char_facet_t

enum class boost::locale::char_facet_t : uint32_t
strong

Type that specifies the character type that locales can be generated for

Supports bitwise OR and bitwise AND (the latter returning if the type is set)

Enumerator
nochar 

Unspecified character category for character independent facets.

char_f 

8-bit character facets

wchar_f 

wide character facets

char16_f 

C++11 char16_t facets.

char32_f 

C++11 char32_t facets.

Variable Documentation

◆ character_facet_last

constexpr char_facet_t boost::locale::character_facet_last
constexpr
Initial value:
=
char_facet_t::char32_f

Last facet specific for character type.