]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/regex/include/boost/regex/v4/regex_traits.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / regex / include / boost / regex / v4 / regex_traits.hpp
1 /*
2 *
3 * Copyright (c) 2003
4 * John Maddock
5 *
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 /*
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE regex_traits.hpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Declares regular expression traits classes.
17 */
18
19 #ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
20 #define BOOST_REGEX_TRAITS_HPP_INCLUDED
21
22 #ifndef BOOST_REGEX_CONFIG_HPP
23 #include <boost/regex/config.hpp>
24 #endif
25 #ifndef BOOST_REGEX_WORKAROUND_HPP
26 #include <boost/regex/v4/regex_workaround.hpp>
27 #endif
28 #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
29 #include <boost/regex/v4/syntax_type.hpp>
30 #endif
31 #ifndef BOOST_REGEX_ERROR_TYPE_HPP
32 #include <boost/regex/v4/error_type.hpp>
33 #endif
34 #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
35 #include <boost/regex/v4/regex_traits_defaults.hpp>
36 #endif
37 #ifndef BOOST_NO_STD_LOCALE
38 # ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
39 # include <boost/regex/v4/cpp_regex_traits.hpp>
40 # endif
41 #endif
42 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
43 # ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED
44 # include <boost/regex/v4/c_regex_traits.hpp>
45 # endif
46 #endif
47 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
48 # ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
49 # include <boost/regex/v4/w32_regex_traits.hpp>
50 # endif
51 #endif
52 #ifndef BOOST_REGEX_FWD_HPP_INCLUDED
53 #include <boost/regex_fwd.hpp>
54 #endif
55
56 #include "boost/mpl/has_xxx.hpp"
57 #include <boost/static_assert.hpp>
58
59 #ifdef BOOST_MSVC
60 #pragma warning(push)
61 #pragma warning(disable: 4103)
62 #endif
63 #ifdef BOOST_HAS_ABI_HEADERS
64 # include BOOST_ABI_PREFIX
65 #endif
66 #ifdef BOOST_MSVC
67 #pragma warning(pop)
68 #endif
69
70 namespace boost{
71
72 template <class charT, class implementationT >
73 struct regex_traits : public implementationT
74 {
75 regex_traits() : implementationT() {}
76 };
77
78 //
79 // class regex_traits_wrapper.
80 // this is what our implementation will actually store;
81 // it provides default implementations of the "optional"
82 // interfaces that we support, in addition to the
83 // required "standard" ones:
84 //
85 namespace BOOST_REGEX_DETAIL_NS{
86 #if !BOOST_WORKAROUND(__HP_aCC, < 60000)
87 BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag)
88 #else
89 template<class T>
90 struct has_boost_extensions_tag
91 {
92 BOOST_STATIC_CONSTANT(bool, value = false);
93 };
94 #endif
95
96 template <class BaseT>
97 struct default_wrapper : public BaseT
98 {
99 typedef typename BaseT::char_type char_type;
100 std::string error_string(::boost::regex_constants::error_type e)const
101 {
102 return ::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(e);
103 }
104 ::boost::regex_constants::syntax_type syntax_type(char_type c)const
105 {
106 return ((c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
107 }
108 ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
109 {
110 return ((c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
111 }
112 boost::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
113 {
114 return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
115 }
116 char_type translate(char_type c, bool icase)const
117 {
118 return (icase ? this->translate_nocase(c) : this->translate(c));
119 }
120 char_type translate(char_type c)const
121 {
122 return BaseT::translate(c);
123 }
124 char_type tolower(char_type c)const
125 {
126 return ::boost::BOOST_REGEX_DETAIL_NS::global_lower(c);
127 }
128 char_type toupper(char_type c)const
129 {
130 return ::boost::BOOST_REGEX_DETAIL_NS::global_upper(c);
131 }
132 };
133
134 template <class BaseT, bool has_extensions>
135 struct compute_wrapper_base
136 {
137 typedef BaseT type;
138 };
139 #if !BOOST_WORKAROUND(__HP_aCC, < 60000)
140 template <class BaseT>
141 struct compute_wrapper_base<BaseT, false>
142 {
143 typedef default_wrapper<BaseT> type;
144 };
145 #else
146 template <>
147 struct compute_wrapper_base<c_regex_traits<char>, false>
148 {
149 typedef default_wrapper<c_regex_traits<char> > type;
150 };
151 #ifndef BOOST_NO_WREGEX
152 template <>
153 struct compute_wrapper_base<c_regex_traits<wchar_t>, false>
154 {
155 typedef default_wrapper<c_regex_traits<wchar_t> > type;
156 };
157 #endif
158 #endif
159
160 } // namespace BOOST_REGEX_DETAIL_NS
161
162 template <class BaseT>
163 struct regex_traits_wrapper
164 : public ::boost::BOOST_REGEX_DETAIL_NS::compute_wrapper_base<
165 BaseT,
166 ::boost::BOOST_REGEX_DETAIL_NS::has_boost_extensions_tag<BaseT>::value
167 >::type
168 {
169 regex_traits_wrapper(){}
170 private:
171 regex_traits_wrapper(const regex_traits_wrapper&);
172 regex_traits_wrapper& operator=(const regex_traits_wrapper&);
173 };
174
175 } // namespace boost
176
177 #ifdef BOOST_MSVC
178 #pragma warning(push)
179 #pragma warning(disable: 4103)
180 #endif
181 #ifdef BOOST_HAS_ABI_HEADERS
182 # include BOOST_ABI_SUFFIX
183 #endif
184 #ifdef BOOST_MSVC
185 #pragma warning(pop)
186 #endif
187
188 #endif // include
189