# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List

# boost/locale/boundary/facets.hpp

    00001 //
    00002 //  Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
    00003 //
    00004 //  Distributed under the Boost Software License, Version 1.0. (See
    00005 //  accompanying file LICENSE_1_0.txt or copy at
    00006 //  http://www.boost.org/LICENSE_1_0.txt)
    00007 //
    00008 #ifndef BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED
    00009 #define BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED
    00010
    00011 #include <boost/locale/config.hpp>
    00012 #include <boost/locale/boundary/types.hpp>
    00013 #ifdef BOOST_MSVC
    00014 #  pragma warning(push)
    00015 #  pragma warning(disable : 4275 4251 4231 4660)
    00016 #endif
    00017 #include <locale>
    00018 #include <vector>
    00019
    00020
    00021
    00022
    00023 namespace boost {
    00024
    00025     namespace locale {
    00026
    00030         namespace boundary {
    00036
    00037
    00042             struct break_info {
    00043
    00047                 break_info() :
    00048                     offset(0),
    00049                     rule(0)
    00050                 {
    00051                 }
    00056                 break_info(size_t v) :
    00057                     offset(v),
    00058                     rule(0)
    00059                 {
    00060                 }
    00061
    00065                 size_t offset;
    00070                 rule_type rule;
    00071
    00076                 bool operator<(break_info const &other) const
    00077                 {
    00078                     return offset < other.offset;
    00079                 }
    00080             };
    00081
    00086             typedef std::vector<break_info> index_type;
    00087
    00088
    00089             template<typename CharType>
    00090             class boundary_indexing;
    00091
    00092             #ifdef BOOST_LOCALE_DOXYGEN
    00093
    00094
    00095
    00096
    00097
    00098
    00099             template<typename Char>
    00100             class BOOST_LOCALE_DECL boundary_indexing : public std::locale::facet {
    00101             public:
    00105                 boundary_indexing(size_t refs=0) : std::locale::facet(refs)
    00106                 {
    00107                 }
    00115                 virtual index_type map(boundary_type t,Char const *begin,Char const *end) const = 0;
    00119                 static std::locale::id id;
    00120
    00121                 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
    00122                 std::locale::id& __get_id (void) const { return id; }
    00123                 #endif
    00124             };
    00125
    00126             #else
    00127
    00128             template<>
    00129             class BOOST_LOCALE_DECL boundary_indexing<char> : public std::locale::facet {
    00130             public:
    00131                 boundary_indexing(size_t refs=0) : std::locale::facet(refs)
    00132                 {
    00133                 }
    00134                 virtual index_type map(boundary_type t,char const *begin,char const *end) const = 0;
    00135                 static std::locale::id id;
    00136                 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
    00137                 std::locale::id& __get_id (void) const { return id; }
    00138                 #endif
    00139             };
    00140
    00141             template<>
    00142             class BOOST_LOCALE_DECL boundary_indexing<wchar_t> : public std::locale::facet {
    00143             public:
    00144                 boundary_indexing(size_t refs=0) : std::locale::facet(refs)
    00145                 {
    00146                 }
    00147                 virtual index_type map(boundary_type t,wchar_t const *begin,wchar_t const *end) const = 0;
    00148
    00149                 static std::locale::id id;
    00150                 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
    00151                 std::locale::id& __get_id (void) const { return id; }
    00152                 #endif
    00153             };
    00154
    00155             #ifdef BOOST_HAS_CHAR16_T
    00156             template<>
    00157             class BOOST_LOCALE_DECL boundary_indexing<char16_t> : public std::locale::facet {
    00158             public:
    00159                 boundary_indexing(size_t refs=0) : std::locale::facet(refs)
    00160                 {
    00161                 }
    00162                 virtual index_type map(boundary_type t,char16_t const *begin,char16_t const *end) const = 0;
    00163                 static std::locale::id id;
    00164                 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
    00165                 std::locale::id& __get_id (void) const { return id; }
    00166                 #endif
    00167             };
    00168             #endif
    00169
    00170             #ifdef BOOST_HAS_CHAR32_T
    00171             template<>
    00172             class BOOST_LOCALE_DECL boundary_indexing<char32_t> : public std::locale::facet {
    00173             public:
    00174                 boundary_indexing(size_t refs=0) : std::locale::facet(refs)
    00175                 {
    00176                 }
    00177                 virtual index_type map(boundary_type t,char32_t const *begin,char32_t const *end) const = 0;
    00178                 static std::locale::id id;
    00179                 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
    00180                 std::locale::id& __get_id (void) const { return id; }
    00181                 #endif
    00182             };
    00183             #endif
    00184
    00185             #endif
    00186
    00190
    00191
    00192         } // boundary
    00193
    00194     } // locale
    00195 } // boost
    00196
    00197
    00198 #ifdef BOOST_MSVC
    00199 #pragma warning(pop)
    00200 #endif
    00201
    00202 #endif
    00203 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4