]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
2 | // | |
3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | #if !defined(SPIRIT_STRICT_RELAXED_APR_22_2010_0959AM) | |
7 | #define SPIRIT_STRICT_RELAXED_APR_22_2010_0959AM | |
8 | ||
9 | #if defined(_MSC_VER) | |
10 | #pragma once | |
11 | #endif | |
12 | ||
13 | #include <boost/spirit/home/support/common_terminals.hpp> | |
14 | #include <boost/spirit/home/support/modify.hpp> | |
15 | #include <boost/spirit/home/karma/domain.hpp> | |
16 | #include <boost/spirit/home/karma/meta_compiler.hpp> | |
17 | ||
18 | namespace boost { namespace spirit | |
19 | { | |
20 | /////////////////////////////////////////////////////////////////////////// | |
21 | // Enablers | |
22 | /////////////////////////////////////////////////////////////////////////// | |
23 | template <> | |
24 | struct use_directive<karma::domain, tag::strict> // enables strict[] | |
25 | : mpl::true_ {}; | |
26 | ||
27 | template <> | |
28 | struct use_directive<karma::domain, tag::relaxed> // enables relaxed[] | |
29 | : mpl::true_ {}; | |
30 | ||
31 | /////////////////////////////////////////////////////////////////////////// | |
32 | template <> | |
33 | struct is_modifier_directive<karma::domain, tag::strict> | |
34 | : mpl::true_ {}; | |
35 | ||
36 | template <> | |
37 | struct is_modifier_directive<karma::domain, tag::relaxed> | |
38 | : mpl::true_ {}; | |
39 | ||
40 | /////////////////////////////////////////////////////////////////////////// | |
41 | // Don't add tag::strict or tag::relaxed if there is already one of those | |
42 | // in the modifier list | |
43 | template <typename Current> | |
44 | struct compound_modifier<Current, tag::strict | |
45 | , typename enable_if<has_modifier<Current, tag::relaxed> >::type> | |
46 | : Current | |
47 | { | |
48 | compound_modifier() | |
49 | : Current() {} | |
50 | ||
51 | compound_modifier(Current const& current, tag::strict const&) | |
52 | : Current(current) {} | |
53 | }; | |
54 | ||
55 | template <typename Current> | |
56 | struct compound_modifier<Current, tag::relaxed | |
57 | , typename enable_if<has_modifier<Current, tag::strict> >::type> | |
58 | : Current | |
59 | { | |
60 | compound_modifier() | |
61 | : Current() {} | |
62 | ||
63 | compound_modifier(Current const& current, tag::relaxed const&) | |
64 | : Current(current) {} | |
65 | }; | |
66 | ||
67 | namespace karma | |
68 | { | |
69 | #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS | |
70 | using boost::spirit::strict; | |
71 | using boost::spirit::relaxed; | |
72 | #endif | |
73 | using boost::spirit::strict_type; | |
74 | using boost::spirit::relaxed_type; | |
75 | } | |
76 | }} | |
77 | ||
78 | #endif |