1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | // modifier.hpp |
---|
3 | // |
---|
4 | // Copyright 2004 Eric Niebler. Distributed under the Boost |
---|
5 | // Software License, Version 1.0. (See accompanying file |
---|
6 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
7 | |
---|
8 | #ifndef BOOST_XPRESSIVE_DETAIL_STATIC_MODIFIER_HPP_EAN_10_04_2005 |
---|
9 | #define BOOST_XPRESSIVE_DETAIL_STATIC_MODIFIER_HPP_EAN_10_04_2005 |
---|
10 | |
---|
11 | // MS compatible compilers support #pragma once |
---|
12 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
---|
13 | # pragma once |
---|
14 | # pragma warning(push) |
---|
15 | # pragma warning(disable : 4510) // default constructor could not be generated |
---|
16 | # pragma warning(disable : 4610) // user defined constructor required |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <boost/xpressive/detail/detail_fwd.hpp> |
---|
20 | #include <boost/xpressive/regex_constants.hpp> |
---|
21 | #include <boost/xpressive/detail/static/as_xpr.hpp> |
---|
22 | |
---|
23 | namespace boost { namespace xpressive { namespace detail |
---|
24 | { |
---|
25 | |
---|
26 | /////////////////////////////////////////////////////////////////////////////// |
---|
27 | // modifier |
---|
28 | template<typename Modifier> |
---|
29 | struct modifier_op |
---|
30 | { |
---|
31 | typedef regex_constants::syntax_option_type opt_type; |
---|
32 | |
---|
33 | template<typename Xpr> |
---|
34 | struct apply |
---|
35 | { |
---|
36 | typedef proto::binary_op<Modifier, typename as_xpr_type<Xpr>::type, modifier_tag> type; |
---|
37 | }; |
---|
38 | |
---|
39 | template<typename Xpr> |
---|
40 | typename apply<Xpr>::type |
---|
41 | operator ()(Xpr const &xpr) const |
---|
42 | { |
---|
43 | return proto::make_op<modifier_tag>(this->mod_, as_xpr(xpr)); |
---|
44 | } |
---|
45 | |
---|
46 | operator opt_type() const |
---|
47 | { |
---|
48 | return this->opt_; |
---|
49 | } |
---|
50 | |
---|
51 | Modifier mod_; |
---|
52 | opt_type opt_; |
---|
53 | }; |
---|
54 | |
---|
55 | }}} |
---|
56 | |
---|
57 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
---|
58 | # pragma warning(pop) |
---|
59 | #endif |
---|
60 | |
---|
61 | #endif |
---|