7 #ifndef BOOST_LOCALE_CONVERTER_HPP_INCLUDED 8 #define BOOST_LOCALE_CONVERTER_HPP_INCLUDED 10 #include <boost/locale/util/string.hpp> 14 # pragma warning(push) 15 # pragma warning(disable : 4275 4251 4231 4660) 18 namespace boost {
namespace locale {
38 template<
typename CharType>
41 #ifdef BOOST_LOCALE_DOXYGEN 42 template<
typename Char>
51 static std::locale::id
id;
54 converter(
size_t refs = 0) : std::locale::facet(refs) {}
58 virtual std::basic_string<Char>
59 convert(conversion_type how,
const Char* begin,
const Char* end,
int flags = 0)
const = 0;
64 class BOOST_LOCALE_DECL converter<char> :
public converter_base,
public std::locale::facet {
66 static std::locale::id id;
68 converter(
size_t refs = 0) : std::locale::facet(refs) {}
70 virtual std::string
convert(conversion_type how,
const char* begin,
const char* end,
int flags = 0)
const = 0;
74 class BOOST_LOCALE_DECL converter<wchar_t> :
public converter_base,
public std::locale::facet {
76 static std::locale::id id;
77 converter(
size_t refs = 0) : std::locale::facet(refs) {}
80 convert(conversion_type how,
const wchar_t* begin,
const wchar_t* end,
int flags = 0)
const = 0;
83 # ifdef BOOST_LOCALE_ENABLE_CHAR16_T 85 class BOOST_LOCALE_DECL converter<char16_t> :
public converter_base,
public std::locale::facet {
87 static std::locale::id id;
88 converter(
size_t refs = 0) : std::locale::facet(refs) {}
90 virtual std::u16string
91 convert(conversion_type how,
const char16_t* begin,
const char16_t* end,
int flags = 0)
const = 0;
95 # ifdef BOOST_LOCALE_ENABLE_CHAR32_T 97 class BOOST_LOCALE_DECL converter<char32_t> :
public converter_base,
public std::locale::facet {
99 static std::locale::id id;
100 converter(
size_t refs = 0) : std::locale::facet(refs) {}
102 virtual std::u32string
103 convert(conversion_type how,
const char32_t* begin,
const char32_t* end,
int flags = 0)
const = 0;
125 template<
typename CharType>
126 std::basic_string<CharType>
normalize(
const CharType* begin,
129 const std::locale& loc = std::locale())
141 template<
typename CharType>
142 std::basic_string<CharType>
normalize(
const std::basic_string<CharType>& str,
144 const std::locale& loc = std::locale())
146 return normalize(str.data(), str.data() + str.size(), n, loc);
156 template<
typename CharType>
157 std::basic_string<CharType>
168 template<
typename CharType>
169 std::basic_string<CharType>
170 to_upper(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
178 template<
typename CharType>
179 std::basic_string<CharType>
to_upper(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
181 return to_upper(str.data(), str.data() + str.size(), loc);
187 template<
typename CharType>
188 std::basic_string<CharType>
to_upper(
const CharType* str,
const std::locale& loc = std::locale())
198 template<
typename CharType>
199 std::basic_string<CharType>
200 to_lower(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
208 template<
typename CharType>
209 std::basic_string<CharType>
to_lower(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
211 return to_lower(str.data(), str.data() + str.size(), loc);
217 template<
typename CharType>
218 std::basic_string<CharType>
to_lower(
const CharType* str,
const std::locale& loc = std::locale())
228 template<
typename CharType>
229 std::basic_string<CharType>
230 to_title(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
238 template<
typename CharType>
239 std::basic_string<CharType>
to_title(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
241 return to_title(str.data(), str.data() + str.size(), loc);
247 template<
typename CharType>
248 std::basic_string<CharType>
to_title(
const CharType* str,
const std::locale& loc = std::locale())
258 template<
typename CharType>
259 std::basic_string<CharType>
260 fold_case(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
268 template<
typename CharType>
269 std::basic_string<CharType>
fold_case(
const std::basic_string<CharType>& str,
270 const std::locale& loc = std::locale())
272 return fold_case(str.data(), str.data() + str.size(), loc);
278 template<
typename CharType>
279 std::basic_string<CharType>
fold_case(
const CharType* str,
const std::locale& loc = std::locale())
288 # pragma warning(pop) std::basic_string< CharType > fold_case(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:260
Canonical decomposition.
Definition: conversion.hpp:111
Apply Unicode normalization on the text.
Definition: conversion.hpp:30
The facet that implements text manipulation.
Definition: conversion.hpp:39
Convert text to lower case.
Definition: conversion.hpp:32
std::basic_string< CharType > normalize(const CharType *begin, const CharType *end, norm_type n=norm_default, const std::locale &loc=std::locale())
Definition: conversion.hpp:126
Convert text to upper case.
Definition: conversion.hpp:31
Compatibility decomposition.
Definition: conversion.hpp:113
This class provides base flags for text manipulation. It is used as base for converter facet.
Definition: conversion.hpp:26
Convert text to title case.
Definition: conversion.hpp:34
Generate conversion facets.
norm_type
The type that defined normalization form
Definition: conversion.hpp:110
Compatibility decomposition followed by canonical composition.
Definition: conversion.hpp:114
conversion_type
The flag used for facet - the type of operation to perform.
Definition: conversion.hpp:29
Char * str_end(Char *str)
Return the end of a C-string, i.e. the pointer to the trailing NULL byte.
Definition: string.hpp:15
Fold case in the text.
Definition: conversion.hpp:33
std::basic_string< CharType > to_lower(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:200
static std::locale::id id
Locale identification.
Definition: conversion.hpp:51
Canonical decomposition followed by canonical composition.
Definition: conversion.hpp:112
std::basic_string< CharType > to_upper(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:170
converter(size_t refs=0)
Standard constructor.
Definition: conversion.hpp:54
Default normalization - canonical decomposition followed by canonical composition.
Definition: conversion.hpp:115
std::basic_string< CharType > to_title(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:230