]>
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 | ||
7c673cae | 24 | // silence MSVC warning C4512: assignment operator could not be generated |
92f5a8d4 | 25 | BOOST_DELETED_FUNCTION(unused_delimiter& operator= (unused_delimiter const&)) |
7c673cae FG |
26 | }; |
27 | ||
28 | // If a surrounding verbatim[] directive was specified, the current | |
29 | // delimiter is of the type unused_delimiter. In this case we | |
30 | // re-activate the delimiter which was active before the verbatim[] | |
31 | // directive. | |
32 | template <typename Delimiter, typename Default> | |
33 | inline Delimiter const& | |
34 | get_delimiter(unused_delimiter<Delimiter> const& u, Default const&) | |
35 | { | |
36 | return u.delimiter; | |
37 | } | |
38 | ||
39 | // If no surrounding verbatim[] directive was specified we activate | |
40 | // a single space as the delimiter to use. | |
41 | template <typename Delimiter, typename Default> | |
42 | inline Default const& | |
43 | get_delimiter(Delimiter const&, Default const& d) | |
44 | { | |
45 | return d; | |
46 | } | |
47 | ||
48 | }}}} | |
49 | ||
50 | #endif |