1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/xpressive/regex_traits.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +///////////////////////////////////////////////////////////////////////////////
1.5 +/// \file regex_traits.hpp
1.6 +/// Includes the C regex traits or the CPP regex traits header file depending on the
1.7 +/// BOOST_XPRESSIVE_USE_C_TRAITS macro.
1.8 +//
1.9 +// Copyright 2004 Eric Niebler. Distributed under the Boost
1.10 +// Software License, Version 1.0. (See accompanying file
1.11 +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.12 +
1.13 +#ifndef BOOST_XPRESSIVE_REGEX_TRAITS_HPP_EAN_10_04_2005
1.14 +#define BOOST_XPRESSIVE_REGEX_TRAITS_HPP_EAN_10_04_2005
1.15 +
1.16 +// MS compatible compilers support #pragma once
1.17 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.18 +# pragma once
1.19 +#endif
1.20 +
1.21 +#include <boost/xpressive/detail/detail_fwd.hpp>
1.22 +
1.23 +#ifdef BOOST_XPRESSIVE_USE_C_TRAITS
1.24 +# include <boost/xpressive/traits/c_regex_traits.hpp>
1.25 +#else
1.26 +# include <boost/xpressive/traits/cpp_regex_traits.hpp>
1.27 +#endif
1.28 +
1.29 +namespace boost { namespace xpressive
1.30 +{
1.31 +
1.32 +///////////////////////////////////////////////////////////////////////////////
1.33 +// regex_traits_version_1_tag
1.34 +/// Tag used to denote that a traits class conforms to the version 1 traits
1.35 +/// interface.
1.36 +struct regex_traits_version_1_tag
1.37 +{
1.38 +};
1.39 +
1.40 +///////////////////////////////////////////////////////////////////////////////
1.41 +// regex_traits_version_1_case_fold_tag
1.42 +/// Tag used to denote that a traits class has the fold_case member function.
1.43 +struct regex_traits_version_1_case_fold_tag
1.44 + : regex_traits_version_1_tag
1.45 +{
1.46 +};
1.47 +
1.48 +///////////////////////////////////////////////////////////////////////////////
1.49 +// regex_traits
1.50 +/// Thin wrapper around the default regex_traits implementation, either
1.51 +/// cpp_regex_traits or c_regex_traits
1.52 +///
1.53 +template<typename Char, typename Impl>
1.54 +struct regex_traits
1.55 + : Impl
1.56 +{
1.57 + typedef typename Impl::locale_type locale_type;
1.58 +
1.59 + regex_traits()
1.60 + : Impl()
1.61 + {
1.62 + }
1.63 +
1.64 + explicit regex_traits(locale_type const &loc)
1.65 + : Impl(loc)
1.66 + {
1.67 + }
1.68 +};
1.69 +
1.70 +///////////////////////////////////////////////////////////////////////////////
1.71 +// lookup_classname
1.72 +/// INTERNAL ONLY
1.73 +template<typename Traits, std::size_t N>
1.74 +inline typename Traits::char_class_type
1.75 +lookup_classname(Traits const &traits, char const (&cname)[N], bool icase)
1.76 +{
1.77 + typename Traits::char_type name[N] = {0};
1.78 + for(std::size_t j = 0; j < N-1; ++j)
1.79 + {
1.80 + name[j] = traits.widen(cname[j]);
1.81 + }
1.82 + return traits.lookup_classname(name, name + N - 1, icase);
1.83 +}
1.84 +
1.85 +}}
1.86 +
1.87 +#endif