]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/regex/v5/regex_traits.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / regex / v5 / 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 #include <boost/regex/config.hpp>
23 #include <boost/regex/v5/regex_workaround.hpp>
24 #include <boost/regex/v5/syntax_type.hpp>
25 #include <boost/regex/v5/error_type.hpp>
26 #include <boost/regex/v5/regex_traits_defaults.hpp>
27 #include <boost/regex/v5/cpp_regex_traits.hpp>
28 #include <boost/regex/v5/c_regex_traits.hpp>
29 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
30 # include <boost/regex/v5/w32_regex_traits.hpp>
31 #endif
32 #include <boost/regex_fwd.hpp>
33
34 namespace boost{
35
36 template <class charT, class implementationT >
37 struct regex_traits : public implementationT
38 {
39 regex_traits() : implementationT() {}
40 };
41
42 //
43 // class regex_traits_wrapper.
44 // this is what our implementation will actually store;
45 // it provides default implementations of the "optional"
46 // interfaces that we support, in addition to the
47 // required "standard" ones:
48 //
49 namespace BOOST_REGEX_DETAIL_NS{
50
51 template <class T>
52 struct has_boost_extensions_tag
53 {
54 template <class U>
55 static double checker(U*, typename U::boost_extensions_tag* = nullptr);
56 static char checker(...);
57 static T* get();
58
59 static const bool value = sizeof(checker(get())) > 1;
60 };
61
62
63 template <class BaseT>
64 struct default_wrapper : public BaseT
65 {
66 typedef typename BaseT::char_type char_type;
67 std::string error_string(::boost::regex_constants::error_type e)const
68 {
69 return ::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(e);
70 }
71 ::boost::regex_constants::syntax_type syntax_type(char_type c)const
72 {
73 return (char_type(c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
74 }
75 ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
76 {
77 return (char_type(c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
78 }
79 std::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
80 {
81 return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
82 }
83 char_type translate(char_type c, bool icase)const
84 {
85 return (icase ? this->translate_nocase(c) : this->translate(c));
86 }
87 char_type translate(char_type c)const
88 {
89 return BaseT::translate(c);
90 }
91 char_type tolower(char_type c)const
92 {
93 return ::boost::BOOST_REGEX_DETAIL_NS::global_lower(c);
94 }
95 char_type toupper(char_type c)const
96 {
97 return ::boost::BOOST_REGEX_DETAIL_NS::global_upper(c);
98 }
99 };
100
101 template <class BaseT, bool has_extensions>
102 struct compute_wrapper_base
103 {
104 typedef BaseT type;
105 };
106 template <class BaseT>
107 struct compute_wrapper_base<BaseT, false>
108 {
109 typedef default_wrapper<BaseT> type;
110 };
111
112 } // namespace BOOST_REGEX_DETAIL_NS
113
114 template <class BaseT>
115 struct regex_traits_wrapper
116 : public ::boost::BOOST_REGEX_DETAIL_NS::compute_wrapper_base<
117 BaseT,
118 ::boost::BOOST_REGEX_DETAIL_NS::has_boost_extensions_tag<BaseT>::value
119 >::type
120 {
121 regex_traits_wrapper(){}
122 private:
123 regex_traits_wrapper(const regex_traits_wrapper&);
124 regex_traits_wrapper& operator=(const regex_traits_wrapper&);
125 };
126
127 } // namespace boost
128
129 #endif // include
130