]>
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(BOOST_SPIRIT_KARMA_UNUSED_DELIMITER_MAR_15_2009_0923PM) | |
7 | #define BOOST_SPIRIT_KARMA_UNUSED_DELIMITER_MAR_15_2009_0923PM | |
8 | ||
9 | #if defined(_MSC_VER) | |
10 | #pragma once | |
11 | #endif | |
12 | ||
13 | #include <boost/spirit/home/support/unused.hpp> | |
14 | ||
15 | namespace boost { namespace spirit { namespace karma { namespace detail | |
16 | { | |
17 | template <typename Delimiter> | |
18 | struct unused_delimiter : unused_type | |
19 | { | |
20 | unused_delimiter(Delimiter const& delim) | |
21 | : delimiter(delim) {} | |
22 | Delimiter const& delimiter; | |
23 | ||
24 | private: | |
25 | // silence MSVC warning C4512: assignment operator could not be generated | |
26 | unused_delimiter& operator= (unused_delimiter const&); | |
27 | }; | |
28 | ||
29 | // If a surrounding verbatim[] directive was specified, the current | |
30 | // delimiter is of the type unused_delimiter. In this case we | |
31 | // re-activate the delimiter which was active before the verbatim[] | |
32 | // directive. | |
33 | template <typename Delimiter, typename Default> | |
34 | inline Delimiter const& | |
35 | get_delimiter(unused_delimiter<Delimiter> const& u, Default const&) | |
36 | { | |
37 | return u.delimiter; | |
38 | } | |
39 | ||
40 | // If no surrounding verbatim[] directive was specified we activate | |
41 | // a single space as the delimiter to use. | |
42 | template <typename Delimiter, typename Default> | |
43 | inline Default const& | |
44 | get_delimiter(Delimiter const&, Default const& d) | |
45 | { | |
46 | return d; | |
47 | } | |
48 | ||
49 | }}}} | |
50 | ||
51 | #endif |