~ai.tron/armagetronad/0.4-winlibs-updated

« back to all changes in this revision

Viewing changes to boost/includes/boost/log/support/xpressive.hpp

  • Committer: Nik K.
  • Date: 2013-11-07 16:58:35 UTC
  • Revision ID: nik.karbaum@gmail.com-20131107165835-kq99jz23drfj4dkh
Forgot to add some files; here they are

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *          Copyright Andrey Semashev 2007 - 2013.
 
3
 * Distributed under the Boost Software License, Version 1.0.
 
4
 *    (See accompanying file LICENSE_1_0.txt or copy at
 
5
 *          http://www.boost.org/LICENSE_1_0.txt)
 
6
 */
 
7
/*!
 
8
 * \file   support/xpressive.hpp
 
9
 * \author Andrey Semashev
 
10
 * \date   18.07.2009
 
11
 *
 
12
 * This header enables Boost.Xpressive support for Boost.Log.
 
13
 */
 
14
 
 
15
#ifndef BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_
 
16
#define BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_
 
17
 
 
18
#include <boost/mpl/bool.hpp>
 
19
#include <boost/xpressive/basic_regex.hpp>
 
20
#include <boost/xpressive/regex_constants.hpp>
 
21
#include <boost/xpressive/regex_algorithms.hpp>
 
22
#include <boost/log/detail/config.hpp>
 
23
#include <boost/log/utility/functional/matches.hpp>
 
24
#include <boost/log/detail/header.hpp>
 
25
 
 
26
#ifdef BOOST_LOG_HAS_PRAGMA_ONCE
 
27
#pragma once
 
28
#endif
 
29
 
 
30
namespace boost {
 
31
 
 
32
BOOST_LOG_OPEN_NAMESPACE
 
33
 
 
34
namespace aux {
 
35
 
 
36
//! The trait verifies if the type can be converted to a Boost.Xpressive regex
 
37
template< typename T >
 
38
struct is_xpressive_regex< T, true >
 
39
{
 
40
private:
 
41
    typedef char yes_type;
 
42
    struct no_type { char dummy[2]; };
 
43
 
 
44
    template< typename U >
 
45
    static yes_type check_xpressive_regex(xpressive::basic_regex< U > const&);
 
46
    static no_type check_xpressive_regex(...);
 
47
    static T& get_T();
 
48
 
 
49
public:
 
50
    enum { value = sizeof(check_xpressive_regex(get_T())) == sizeof(yes_type) };
 
51
    typedef mpl::bool_< value > type;
 
52
};
 
53
 
 
54
//! The regex matching functor implementation
 
55
template< >
 
56
struct matches_fun_impl< boost_xpressive_expression_tag >
 
57
{
 
58
    template< typename StringT, typename T >
 
59
    static bool matches(
 
60
        StringT const& str,
 
61
        xpressive::basic_regex< T > const& expr,
 
62
        xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
 
63
    {
 
64
        return xpressive::regex_match(str, expr, flags);
 
65
    }
 
66
 
 
67
    template< typename StringT >
 
68
    static bool matches(
 
69
        StringT const& str,
 
70
        xpressive::basic_regex< typename StringT::value_type* > const& expr,
 
71
        xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
 
72
    {
 
73
        return xpressive::regex_match(str.c_str(), expr, flags);
 
74
    }
 
75
 
 
76
    template< typename StringT >
 
77
    static bool matches(
 
78
        StringT const& str,
 
79
        xpressive::basic_regex< typename StringT::value_type const* > const& expr,
 
80
        xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default)
 
81
    {
 
82
        return xpressive::regex_match(str.c_str(), expr, flags);
 
83
    }
 
84
};
 
85
 
 
86
} // namespace aux
 
87
 
 
88
BOOST_LOG_CLOSE_NAMESPACE // namespace log
 
89
 
 
90
} // namespace boost
 
91
 
 
92
#include <boost/log/detail/footer.hpp>
 
93
 
 
94
#endif // BOOST_LOG_SUPPORT_XPRESSIVE_HPP_INCLUDED_