include/boost/regex/v5/regex_traits.hpp

100.0% Lines (18/18) 96.9% List of functions (31/33)
regex_traits.hpp
f(x) Functions (33)
Function Calls Lines Blocks
boost::regex_traits<char, boost::cpp_regex_traits<char> >::regex_traits() :39 76x 100.0% 100.0% boost::regex_traits<wchar_t, boost::cpp_regex_traits<wchar_t> >::regex_traits() :39 10x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::error_string[abi:cxx11](boost::regex_constants::error_type) const :67 6252x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::error_string[abi:cxx11](boost::regex_constants::error_type) const :67 6252x 100.0% 100.0% boost::re_detail_600::default_wrapper<char32_traits>::error_string[abi:cxx11](boost::regex_constants::error_type) const :67 0 0.0% 0.0% <unknown function 69> :69 boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::syntax_type(char) const :71 3630786x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::syntax_type(wchar_t) const :71 1322809x 100.0% 100.0% boost::re_detail_600::default_wrapper<char32_traits>::syntax_type(char32_t) const :71 24x 100.0% 80.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::escape_syntax_type(char) const :75 706634x 100.0% 80.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::escape_syntax_type(wchar_t) const :75 61008x 100.0% 80.0% boost::re_detail_600::default_wrapper<char32_traits>::escape_syntax_type(char32_t) const :75 16x 100.0% 80.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::toi(char const*&, char const*, int) const :79 227820x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::toi(wchar_t const*&, wchar_t const*, int) const :79 37464x 100.0% 100.0% boost::re_detail_600::default_wrapper<char32_traits>::toi(char32_t const*&, char32_t const*, int) const :79 8x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::translate(char, bool) const :83 225752532x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::translate(wchar_t, bool) const :83 43636489x 100.0% 100.0% boost::re_detail_600::default_wrapper<char32_traits>::translate(char32_t, bool) const :83 272x 100.0% 80.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::translate(char) const :87 223247316x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::translate(wchar_t) const :87 41355169x 100.0% 100.0% boost::re_detail_600::default_wrapper<char32_traits>::translate(char32_t) const :87 272x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::tolower(char) const :91 180x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::tolower(wchar_t) const :91 180x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<char> >::toupper(char) const :95 132x 100.0% 100.0% boost::re_detail_600::default_wrapper<boost::c_regex_traits<wchar_t> >::toupper(wchar_t) const :95 132x 100.0% 100.0% boost::regex_traits_wrapper<boost::c_regex_traits<char> >::regex_traits_wrapper() :121 45052x 100.0% 100.0% boost::regex_traits_wrapper<boost::c_regex_traits<wchar_t> >::regex_traits_wrapper() :121 45373x 100.0% 100.0% boost::regex_traits_wrapper<boost::cpp_regex_traits<char> >::regex_traits_wrapper() :121 28668x 100.0% 100.0% boost::regex_traits_wrapper<boost::cpp_regex_traits<wchar_t> >::regex_traits_wrapper() :121 28776x 100.0% 100.0% boost::regex_traits_wrapper<boost::icu_regex_traits>::regex_traits_wrapper() :121 149240x 100.0% 100.0% boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > >::regex_traits_wrapper() :121 76x 100.0% 100.0% boost::regex_traits_wrapper<boost::regex_traits<wchar_t, boost::cpp_regex_traits<wchar_t> > >::regex_traits_wrapper() :121 10x 100.0% 100.0% boost::regex_traits_wrapper<char32_traits>::regex_traits_wrapper() :121 1x 100.0% 100.0%
Line TLA Hits Source Code
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 BOOST_REGEX_MODULE_EXPORT template <class charT, class implementationT >
37 struct regex_traits : public implementationT
38 {
39 86x 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 12504x std::string error_string(::boost::regex_constants::error_type e)const
68 {
69 25008x return ::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(e);
70 }
71 4953619x ::boost::regex_constants::syntax_type syntax_type(char_type c)const
72 {
73 4953619x return (char_type(c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
74 }
75 767658x ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
76 {
77 767658x return (char_type(c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
78 }
79 265292x std::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
80 {
81 265292x return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
82 }
83 269389293x char_type translate(char_type c, bool icase)const
84 {
85 269389293x return (icase ? this->translate_nocase(c) : this->translate(c));
86 }
87 264602757x char_type translate(char_type c)const
88 {
89 264602757x return BaseT::translate(c);
90 }
91 360x char_type tolower(char_type c)const
92 {
93 360x return ::boost::BOOST_REGEX_DETAIL_NS::global_lower(c);
94 }
95 264x char_type toupper(char_type c)const
96 {
97 264x 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 297196x 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
131