Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:26

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 #ifndef BOOST_REGEX_CONFIG_HPP
0023 #include <boost/regex/config.hpp>
0024 #endif
0025 #ifndef BOOST_REGEX_WORKAROUND_HPP
0026 #include <boost/regex/v4/regex_workaround.hpp>
0027 #endif
0028 #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
0029 #include <boost/regex/v4/syntax_type.hpp>
0030 #endif
0031 #ifndef BOOST_REGEX_ERROR_TYPE_HPP
0032 #include <boost/regex/v4/error_type.hpp>
0033 #endif
0034 #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
0035 #include <boost/regex/v4/regex_traits_defaults.hpp>
0036 #endif
0037 #ifndef BOOST_NO_STD_LOCALE
0038 #  ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
0039 #     include <boost/regex/v4/cpp_regex_traits.hpp>
0040 #  endif
0041 #endif
0042 #if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
0043 #  ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED
0044 #     include <boost/regex/v4/c_regex_traits.hpp>
0045 #  endif
0046 #endif
0047 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
0048 #  ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
0049 #     include <boost/regex/v4/w32_regex_traits.hpp>
0050 #  endif
0051 #endif
0052 #ifndef BOOST_REGEX_FWD_HPP_INCLUDED
0053 #include <boost/regex_fwd.hpp>
0054 #endif
0055 
0056 #include "boost/mpl/has_xxx.hpp"
0057 #include <boost/static_assert.hpp>
0058 
0059 #ifdef BOOST_MSVC
0060 #pragma warning(push)
0061 #pragma warning(disable: 4103)
0062 #endif
0063 #ifdef BOOST_HAS_ABI_HEADERS
0064 #  include BOOST_ABI_PREFIX
0065 #endif
0066 #ifdef BOOST_MSVC
0067 #pragma warning(pop)
0068 #endif
0069 
0070 namespace boost{
0071 
0072 template <class charT, class implementationT >
0073 struct regex_traits : public implementationT
0074 {
0075    regex_traits() : implementationT() {}
0076 };
0077 
0078 //
0079 // class regex_traits_wrapper.
0080 // this is what our implementation will actually store;
0081 // it provides default implementations of the "optional"
0082 // interfaces that we support, in addition to the
0083 // required "standard" ones:
0084 //
0085 namespace BOOST_REGEX_DETAIL_NS{
0086 #if !BOOST_WORKAROUND(__HP_aCC, < 60000)
0087 BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag)
0088 #else
0089 template<class T>
0090 struct has_boost_extensions_tag
0091 {
0092    BOOST_STATIC_CONSTANT(bool, value = false);
0093 };
0094 #endif
0095 
0096 template <class BaseT>
0097 struct default_wrapper : public BaseT
0098 {
0099    typedef typename BaseT::char_type char_type;
0100    std::string error_string(::boost::regex_constants::error_type e)const
0101    {
0102       return ::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(e);
0103    }
0104    ::boost::regex_constants::syntax_type syntax_type(char_type c)const
0105    {
0106       return ((c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
0107    }
0108    ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
0109    {
0110       return ((c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
0111    }
0112    boost::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
0113    {
0114       return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
0115    }
0116    char_type translate(char_type c, bool icase)const
0117    {
0118       return (icase ? this->translate_nocase(c) : this->translate(c));
0119    }
0120    char_type translate(char_type c)const
0121    {
0122       return BaseT::translate(c);
0123    }
0124    char_type tolower(char_type c)const
0125    {
0126       return ::boost::BOOST_REGEX_DETAIL_NS::global_lower(c);
0127    }
0128    char_type toupper(char_type c)const
0129    {
0130       return ::boost::BOOST_REGEX_DETAIL_NS::global_upper(c);
0131    }
0132 };
0133 
0134 template <class BaseT, bool has_extensions>
0135 struct compute_wrapper_base
0136 {
0137    typedef BaseT type;
0138 };
0139 #if !BOOST_WORKAROUND(__HP_aCC, < 60000)
0140 template <class BaseT>
0141 struct compute_wrapper_base<BaseT, false>
0142 {
0143    typedef default_wrapper<BaseT> type;
0144 };
0145 #else
0146 template <>
0147 struct compute_wrapper_base<c_regex_traits<char>, false>
0148 {
0149    typedef default_wrapper<c_regex_traits<char> > type;
0150 };
0151 #ifndef BOOST_NO_WREGEX
0152 template <>
0153 struct compute_wrapper_base<c_regex_traits<wchar_t>, false>
0154 {
0155    typedef default_wrapper<c_regex_traits<wchar_t> > type;
0156 };
0157 #endif
0158 #endif
0159 
0160 } // namespace BOOST_REGEX_DETAIL_NS
0161 
0162 template <class BaseT>
0163 struct regex_traits_wrapper 
0164    : public ::boost::BOOST_REGEX_DETAIL_NS::compute_wrapper_base<
0165                BaseT, 
0166                ::boost::BOOST_REGEX_DETAIL_NS::has_boost_extensions_tag<BaseT>::value
0167             >::type
0168 {
0169    regex_traits_wrapper(){}
0170 private:
0171    regex_traits_wrapper(const regex_traits_wrapper&);
0172    regex_traits_wrapper& operator=(const regex_traits_wrapper&);
0173 };
0174 
0175 } // namespace boost
0176 
0177 #ifdef BOOST_MSVC
0178 #pragma warning(push)
0179 #pragma warning(disable: 4103)
0180 #endif
0181 #ifdef BOOST_HAS_ABI_HEADERS
0182 #  include BOOST_ABI_SUFFIX
0183 #endif
0184 #ifdef BOOST_MSVC
0185 #pragma warning(pop)
0186 #endif
0187 
0188 #endif // include
0189