7#ifndef BOOST_LOCALE_CONVERTER_HPP_INCLUDED
8#define BOOST_LOCALE_CONVERTER_HPP_INCLUDED
10#include <boost/locale/detail/facet_id.hpp>
11#include <boost/locale/detail/is_supported_char.hpp>
12#include <boost/locale/util/string.hpp>
17# pragma warning(disable : 4275 4251 4231 4660)
20namespace boost {
namespace locale {
44 template<
typename Char>
46 public std::locale::facet,
47 public detail::facet_id<converter<Char>> {
48 BOOST_LOCALE_ASSERT_IS_SUPPORTED(Char);
52 converter(
size_t refs = 0) : std::locale::facet(refs) {}
55 virtual std::basic_string<Char>
75 template<
typename CharType>
76 std::basic_string<CharType>
normalize(
const CharType* begin,
79 const std::locale& loc = std::locale())
91 template<
typename CharType>
92 std::basic_string<CharType>
normalize(
const std::basic_string<CharType>& str,
94 const std::locale& loc = std::locale())
96 return normalize(str.data(), str.data() + str.size(), n, loc);
106 template<
typename CharType>
107 std::basic_string<CharType>
118 template<
typename CharType>
119 std::basic_string<CharType>
120 to_upper(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
128 template<
typename CharType>
129 std::basic_string<CharType>
to_upper(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
131 return to_upper(str.data(), str.data() + str.size(), loc);
137 template<
typename CharType>
138 std::basic_string<CharType>
to_upper(
const CharType* str,
const std::locale& loc = std::locale())
148 template<
typename CharType>
149 std::basic_string<CharType>
150 to_lower(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
158 template<
typename CharType>
159 std::basic_string<CharType>
to_lower(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
161 return to_lower(str.data(), str.data() + str.size(), loc);
167 template<
typename CharType>
168 std::basic_string<CharType>
to_lower(
const CharType* str,
const std::locale& loc = std::locale())
178 template<
typename CharType>
179 std::basic_string<CharType>
180 to_title(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
188 template<
typename CharType>
189 std::basic_string<CharType>
to_title(
const std::basic_string<CharType>& str,
const std::locale& loc = std::locale())
191 return to_title(str.data(), str.data() + str.size(), loc);
197 template<
typename CharType>
198 std::basic_string<CharType>
to_title(
const CharType* str,
const std::locale& loc = std::locale())
208 template<
typename CharType>
209 std::basic_string<CharType>
210 fold_case(
const CharType* begin,
const CharType* end,
const std::locale& loc = std::locale())
218 template<
typename CharType>
219 std::basic_string<CharType>
fold_case(
const std::basic_string<CharType>& str,
220 const std::locale& loc = std::locale())
222 return fold_case(str.data(), str.data() + str.size(), loc);
228 template<
typename CharType>
229 std::basic_string<CharType>
fold_case(
const CharType* str,
const std::locale& loc = std::locale())
This class provides base flags for text manipulation. It is used as base for converter facet.
Definition: conversion.hpp:28
conversion_type
The flag used for facet - the type of operation to perform.
Definition: conversion.hpp:31
@ upper_case
Convert text to upper case.
Definition: conversion.hpp:33
@ lower_case
Convert text to lower case.
Definition: conversion.hpp:34
@ case_folding
Fold case in the text.
Definition: conversion.hpp:35
@ title_case
Convert text to title case.
Definition: conversion.hpp:36
@ normalization
Apply Unicode normalization on the text.
Definition: conversion.hpp:32
The facet that implements text manipulation.
Definition: conversion.hpp:47
virtual std::basic_string< Char > convert(conversion_type how, const Char *begin, const Char *end, int flags=0) const =0
converter(size_t refs=0)
Standard constructor.
Definition: conversion.hpp:52
std::basic_string< CharType > to_title(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:180
std::basic_string< CharType > to_upper(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:120
std::basic_string< CharType > to_lower(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:150
norm_type
The type that defined normalization form
Definition: conversion.hpp:60
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:76
std::basic_string< CharType > fold_case(const CharType *begin, const CharType *end, const std::locale &loc=std::locale())
Definition: conversion.hpp:210
@ norm_nfkc
Compatibility decomposition followed by canonical composition.
Definition: conversion.hpp:64
@ norm_nfkd
Compatibility decomposition.
Definition: conversion.hpp:63
@ norm_nfd
Canonical decomposition.
Definition: conversion.hpp:61
@ norm_default
Default normalization - canonical decomposition followed by canonical composition.
Definition: conversion.hpp:65
@ norm_nfc
Canonical decomposition followed by canonical composition.
Definition: conversion.hpp:62
Char * str_end(Char *str)
Return the end of a C-string, i.e. the pointer to the trailing NULL byte.
Definition: string.hpp:16
@ convert
Generate conversion facets.