Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:38

0001 /*
0002  *
0003  * Copyright (c) 2003
0004  * John Maddock
0005  *
0006  * Use, modification and distribution are subject to the 
0007  * Boost Software License, Version 1.0. (See accompanying file 
0008  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009  *
0010  */
0011  
0012  /*
0013   *   LOCATION:    see http://www.boost.org for most recent version.
0014   *   FILE         regex_traits.hpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Declares regular expression traits classes.
0017   */
0018 
0019 #ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
0020 #define BOOST_REGEX_TRAITS_HPP_INCLUDED
0021 
0022 #include <boost/regex/config.hpp>
0023 #include <boost/regex/v5/regex_workaround.hpp>
0024 #include <boost/regex/v5/syntax_type.hpp>
0025 #include <boost/regex/v5/error_type.hpp>
0026 #include <boost/regex/v5/regex_traits_defaults.hpp>
0027 #include <boost/regex/v5/cpp_regex_traits.hpp>
0028 #include <boost/regex/v5/c_regex_traits.hpp>
0029 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
0030 #     include <boost/regex/v5/w32_regex_traits.hpp>
0031 #endif
0032 #include <boost/regex_fwd.hpp>
0033 
0034 namespace boost{
0035 
0036 template <class charT, class implementationT >
0037 struct regex_traits : public implementationT
0038 {
0039    regex_traits() : implementationT() {}
0040 };
0041 
0042 //
0043 // class regex_traits_wrapper.
0044 // this is what our implementation will actually store;
0045 // it provides default implementations of the "optional"
0046 // interfaces that we support, in addition to the
0047 // required "standard" ones:
0048 //
0049 namespace BOOST_REGEX_DETAIL_NS{
0050 
0051    template <class T>
0052    struct has_boost_extensions_tag
0053    {
0054       template <class U>
0055       static double checker(U*, typename U::boost_extensions_tag* = nullptr);
0056       static char   checker(...);
0057       static T* get();
0058 
0059       static const bool value = sizeof(checker(get())) > 1;
0060    };
0061    
0062 
0063 template <class BaseT>
0064 struct default_wrapper : public BaseT
0065 {
0066    typedef typename BaseT::char_type char_type;
0067    std::string error_string(::boost::regex_constants::error_type e)const
0068    {
0069       return ::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(e);
0070    }
0071    ::boost::regex_constants::syntax_type syntax_type(char_type c)const
0072    {
0073       return (char_type(c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
0074    }
0075    ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
0076    {
0077       return (char_type(c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
0078    }
0079    std::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
0080    {
0081       return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
0082    }
0083    char_type translate(char_type c, bool icase)const
0084    {
0085       return (icase ? this->translate_nocase(c) : this->translate(c));
0086    }
0087    char_type translate(char_type c)const
0088    {
0089       return BaseT::translate(c);
0090    }
0091    char_type tolower(char_type c)const
0092    {
0093       return ::boost::BOOST_REGEX_DETAIL_NS::global_lower(c);
0094    }
0095    char_type toupper(char_type c)const
0096    {
0097       return ::boost::BOOST_REGEX_DETAIL_NS::global_upper(c);
0098    }
0099 };
0100 
0101 template <class BaseT, bool has_extensions>
0102 struct compute_wrapper_base
0103 {
0104    typedef BaseT type;
0105 };
0106 template <class BaseT>
0107 struct compute_wrapper_base<BaseT, false>
0108 {
0109    typedef default_wrapper<BaseT> type;
0110 };
0111 
0112 } // namespace BOOST_REGEX_DETAIL_NS
0113 
0114 template <class BaseT>
0115 struct regex_traits_wrapper 
0116    : public ::boost::BOOST_REGEX_DETAIL_NS::compute_wrapper_base<
0117                BaseT, 
0118                ::boost::BOOST_REGEX_DETAIL_NS::has_boost_extensions_tag<BaseT>::value
0119             >::type
0120 {
0121    regex_traits_wrapper(){}
0122 private:
0123    regex_traits_wrapper(const regex_traits_wrapper&);
0124    regex_traits_wrapper& operator=(const regex_traits_wrapper&);
0125 };
0126 
0127 } // namespace boost
0128 
0129 #endif // include
0130