7 #ifndef BOOST_LOCALE_CONVERTER_HPP_INCLUDED 8 #define BOOST_LOCALE_CONVERTER_HPP_INCLUDED 10 #include <boost/locale/config.hpp> 11 #include <boost/locale/util/string.hpp> 15 # pragma warning(push) 16 # pragma warning(disable : 4275 4251 4231 4660) 19 namespace boost {
namespace locale {
39 template<
typename CharType>
42 #ifdef BOOST_LOCALE_DOXYGEN 43 template<
typename Char>
52 static std::locale::id
id;
55 converter(
size_t refs = 0) : std::locale::facet(refs) {}
59 virtual std::basic_string<Char>
60 convert(conversion_type how,
const Char* begin,
const Char* end,
int flags = 0)
const = 0;
65 class BOOST_LOCALE_DECL converter<char> :
public converter_base,
public std::locale::facet {
67 static std::locale::id id;
69 converter(
size_t refs = 0) : std::locale::facet(refs) {}
71 virtual std::string
convert(conversion_type how,
const char* begin,
const char* end,
int flags = 0)
const = 0;
75 class BOOST_LOCALE_DECL converter<wchar_t> :
public converter_base,
public std::locale::facet {
77 static std::locale::id id;
78 converter(
size_t refs = 0) : std::locale::facet(refs) {}
81 convert(conversion_type how,
const wchar_t* begin,
const wchar_t* end,
int flags = 0)
const = 0;
84 # ifdef BOOST_LOCALE_ENABLE_CHAR16_T 86 class BOOST_LOCALE_DECL converter<char16_t> :
public converter_base,
public std::locale::facet {
88 static std::locale::id id;
89 converter(
size_t refs = 0) : std::locale::facet(refs) {}
91 virtual std::u16string
92 convert(conversion_type how,
const char16_t* begin,
const char16_t* end,
int flags = 0)
const = 0;
96 # ifdef BOOST_LOCALE_ENABLE_CHAR32_T 98 class BOOST_LOCALE_DECL converter<char32_t> :
public converter_base,
public std::locale::facet {
100 static std::locale::id id;
101 converter(
size_t refs = 0) : std::locale::facet(refs) {}
103 virtual std::u32string
104 convert(conversion_type how,
const char32_t* begin,
const char32_t* end,
int flags = 0)
const = 0;
126 template<
typename CharType>
127 std::basic_string<CharType>
normalize(
const CharType* begin,
130 const std::locale& loc = std::locale())
142 template<
typename CharType>
143 std::basic_string<CharType>
normalize(
const std::basic_string<CharType>& str,
145 const std::locale& loc = std::locale())
147 return normalize(str.data(), str.data() + str.size(), n, loc);
157 template<
typename CharType>
158 std::basic_string<CharType>
169 template<
typename CharType>
170 std::basic_string<CharType>
171 to_upper(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
179 template<
typename CharType>
180 std::basic_string<CharType>
to_upper(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
182 return to_upper(str.data(), str.data() + str.size(), loc);
188 template<
typename CharType>
189 std::basic_string<CharType>
to_upper(
const CharType* str,
const std::locale& loc = std::locale())
199 template<
typename CharType>
200 std::basic_string<CharType>
201 to_lower(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
209 template<
typename CharType>
210 std::basic_string<CharType>
to_lower(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
212 return to_lower(str.data(), str.data() + str.size(), loc);
218 template<
typename CharType>
219 std::basic_string<CharType>
to_lower(
const CharType* str,
const std::locale& loc = std::locale())
229 template<
typename CharType>
230 std::basic_string<CharType>
231 to_title(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
239 template<
typename CharType>
240 std::basic_string<CharType>
to_title(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
242 return to_title(str.data(), str.data() + str.size(), loc);
248 template<
typename CharType>
249 std::basic_string<CharType>
to_title(
const CharType* str,
const std::locale& loc = std::locale())
259 template<
typename CharType>
260 std::basic_string<CharType>
261 fold_case(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
269 template<
typename CharType>
270 std::basic_string<CharType>
fold_case(
const std::basic_string<CharType>& str,
271 const std::locale& loc = std::locale())
273 return fold_case(str.data(), str.data() + str.size(), loc);
279 template<
typename CharType>
280 std::basic_string<CharType>
fold_case(
const CharType* str,
const std::locale& loc = std::locale())
289 # pragma warning(pop) std::basic_string< CharType > fold_case(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:261
Canonical decomposition.
Definition: conversion.hpp:112
Apply Unicode normalization on the text.
Definition: conversion.hpp:31
The facet that implements text manipulation.
Definition: conversion.hpp:40
Convert text to lower case.
Definition: conversion.hpp:33
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:127
Convert text to upper case.
Definition: conversion.hpp:32
Compatibility decomposition.
Definition: conversion.hpp:114
This class provides base flags for text manipulation. It is used as base for converter facet.
Definition: conversion.hpp:27
Convert text to title case.
Definition: conversion.hpp:35
Generate conversion facets.
norm_type
The type that defined normalization form
Definition: conversion.hpp:111
Compatibility decomposition followed by canonical composition.
Definition: conversion.hpp:115
conversion_type
The flag used for facet - the type of operation to perform.
Definition: conversion.hpp:30
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:34
std::basic_string< CharType > to_lower(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:201
static std::locale::id id
Locale identification.
Definition: conversion.hpp:52
Canonical decomposition followed by canonical composition.
Definition: conversion.hpp:113
std::basic_string< CharType > to_upper(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:171
converter(size_t refs=0)
Standard constructor.
Definition: conversion.hpp:55
Default normalization - canonical decomposition followed by canonical composition.
Definition: conversion.hpp:116
std::basic_string< CharType > to_title(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:231