Chris@16: /* Chris@16: * Chris@16: * Copyright (c) 2003 Chris@16: * John Maddock Chris@16: * Chris@16: * Use, modification and distribution are subject to the Chris@16: * Boost Software License, Version 1.0. (See accompanying file Chris@16: * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: */ Chris@16: Chris@16: /* Chris@16: * LOCATION: see http://www.boost.org for most recent version. Chris@16: * FILE regex_traits.hpp Chris@16: * VERSION see Chris@16: * DESCRIPTION: Declares regular expression traits classes. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED Chris@16: #define BOOST_REGEX_TRAITS_HPP_INCLUDED Chris@16: Chris@16: #ifndef BOOST_REGEX_CONFIG_HPP Chris@16: #include Chris@16: #endif Chris@16: #ifndef BOOST_REGEX_WORKAROUND_HPP Chris@16: #include Chris@16: #endif Chris@16: #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP Chris@16: #include Chris@16: #endif Chris@16: #ifndef BOOST_REGEX_ERROR_TYPE_HPP Chris@16: #include Chris@16: #endif Chris@16: #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED Chris@16: #include Chris@16: #endif Chris@16: #ifndef BOOST_NO_STD_LOCALE Chris@16: # ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED Chris@16: # include Chris@16: # endif Chris@16: #endif Chris@16: #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560) Chris@16: # ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED Chris@16: # include Chris@16: # endif Chris@16: #endif Chris@16: #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) Chris@16: # ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED Chris@16: # include Chris@16: # endif Chris@16: #endif Chris@16: #ifndef BOOST_REGEX_FWD_HPP_INCLUDED Chris@16: #include Chris@16: #endif Chris@16: Chris@16: #include "boost/mpl/has_xxx.hpp" Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(push) Chris@16: #pragma warning(disable: 4103) Chris@16: #endif Chris@16: #ifdef BOOST_HAS_ABI_HEADERS Chris@16: # include BOOST_ABI_PREFIX Chris@16: #endif Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: namespace boost{ Chris@16: Chris@16: template Chris@16: struct regex_traits : public implementationT Chris@16: { Chris@16: regex_traits() : implementationT() {} Chris@16: }; Chris@16: Chris@16: // Chris@16: // class regex_traits_wrapper. Chris@16: // this is what our implementation will actually store; Chris@16: // it provides default implementations of the "optional" Chris@16: // interfaces that we support, in addition to the Chris@16: // required "standard" ones: Chris@16: // Chris@16: namespace re_detail{ Chris@101: #if !BOOST_WORKAROUND(__HP_aCC, < 60000) Chris@16: BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag) Chris@16: #else Chris@16: template Chris@16: struct has_boost_extensions_tag Chris@16: { Chris@16: BOOST_STATIC_CONSTANT(bool, value = false); Chris@16: }; Chris@16: #endif Chris@16: Chris@16: template Chris@16: struct default_wrapper : public BaseT Chris@16: { Chris@16: typedef typename BaseT::char_type char_type; Chris@16: std::string error_string(::boost::regex_constants::error_type e)const Chris@16: { Chris@16: return ::boost::re_detail::get_default_error_string(e); Chris@16: } Chris@16: ::boost::regex_constants::syntax_type syntax_type(char_type c)const Chris@16: { Chris@16: return ((c & 0x7f) == c) ? get_default_syntax_type(static_cast(c)) : ::boost::regex_constants::syntax_char; Chris@16: } Chris@16: ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const Chris@16: { Chris@16: return ((c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast(c)) : ::boost::regex_constants::escape_type_identity; Chris@16: } Chris@16: int toi(const char_type*& p1, const char_type* p2, int radix)const Chris@16: { Chris@16: return ::boost::re_detail::global_toi(p1, p2, radix, *this); Chris@16: } Chris@16: char_type translate(char_type c, bool icase)const Chris@16: { Chris@16: return (icase ? this->translate_nocase(c) : this->translate(c)); Chris@16: } Chris@16: char_type translate(char_type c)const Chris@16: { Chris@16: return BaseT::translate(c); Chris@16: } Chris@16: char_type tolower(char_type c)const Chris@16: { Chris@16: return ::boost::re_detail::global_lower(c); Chris@16: } Chris@16: char_type toupper(char_type c)const Chris@16: { Chris@16: return ::boost::re_detail::global_upper(c); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct compute_wrapper_base Chris@16: { Chris@16: typedef BaseT type; Chris@16: }; Chris@101: #if !BOOST_WORKAROUND(__HP_aCC, < 60000) Chris@16: template Chris@16: struct compute_wrapper_base Chris@16: { Chris@16: typedef default_wrapper type; Chris@16: }; Chris@16: #else Chris@16: template <> Chris@16: struct compute_wrapper_base, false> Chris@16: { Chris@16: typedef default_wrapper > type; Chris@16: }; Chris@16: #ifndef BOOST_NO_WREGEX Chris@16: template <> Chris@16: struct compute_wrapper_base, false> Chris@16: { Chris@16: typedef default_wrapper > type; Chris@16: }; Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: } // namespace re_detail Chris@16: Chris@16: template Chris@16: struct regex_traits_wrapper Chris@16: : public ::boost::re_detail::compute_wrapper_base< Chris@16: BaseT, Chris@16: ::boost::re_detail::has_boost_extensions_tag::value Chris@16: >::type Chris@16: { Chris@16: regex_traits_wrapper(){} Chris@16: private: Chris@16: regex_traits_wrapper(const regex_traits_wrapper&); Chris@16: regex_traits_wrapper& operator=(const regex_traits_wrapper&); Chris@16: }; Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(push) Chris@16: #pragma warning(disable: 4103) Chris@16: #endif Chris@16: #ifdef BOOST_HAS_ABI_HEADERS Chris@16: # include BOOST_ABI_SUFFIX Chris@16: #endif Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: #endif // include Chris@16: