| 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 | #ifdef _MSC_VER |
| 18 | # pragma warning(push) |
| 19 | # pragma warning(disable: 4512) // assignment operator could not be generated. |
| 20 | #endif |
| 21 | template <typename Delimiter> |
| 22 | struct unused_delimiter : unused_type |
| 23 | { |
| 24 | unused_delimiter(Delimiter const& delim) |
| 25 | : delimiter(delim) {} |
| 26 | Delimiter const& delimiter; |
| 27 | }; |
| 28 | #ifdef _MSC_VER |
| 29 | # pragma warning(pop) |
| 30 | #endif |
| 31 | |
| 32 | // If a surrounding verbatim[] directive was specified, the current |
| 33 | // delimiter is of the type unused_delimiter. In this case we |
| 34 | // re-activate the delimiter which was active before the verbatim[] |
| 35 | // directive. |
| 36 | template <typename Delimiter, typename Default> |
| 37 | inline Delimiter const& |
| 38 | get_delimiter(unused_delimiter<Delimiter> const& u, Default const&) |
| 39 | { |
| 40 | return u.delimiter; |
| 41 | } |
| 42 | |
| 43 | // If no surrounding verbatim[] directive was specified we activate |
| 44 | // a single space as the delimiter to use. |
| 45 | template <typename Delimiter, typename Default> |
| 46 | inline Default const& |
| 47 | get_delimiter(Delimiter const&, Default const& d) |
| 48 | { |
| 49 | return d; |
| 50 | } |
| 51 | |
| 52 | }}}} |
| 53 | |
| 54 | #endif |
| 55 | |