Chris@16
|
1 // Copyright (c) 2001-2011 Hartmut Kaiser
|
Chris@16
|
2 //
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 #if !defined(BOOST_SPIRIT_KARMA_UNUSED_DELIMITER_MAR_15_2009_0923PM)
|
Chris@16
|
7 #define BOOST_SPIRIT_KARMA_UNUSED_DELIMITER_MAR_15_2009_0923PM
|
Chris@16
|
8
|
Chris@16
|
9 #if defined(_MSC_VER)
|
Chris@16
|
10 #pragma once
|
Chris@16
|
11 #endif
|
Chris@16
|
12
|
Chris@16
|
13 #include <boost/spirit/home/support/unused.hpp>
|
Chris@16
|
14
|
Chris@16
|
15 namespace boost { namespace spirit { namespace karma { namespace detail
|
Chris@16
|
16 {
|
Chris@16
|
17 template <typename Delimiter>
|
Chris@16
|
18 struct unused_delimiter : unused_type
|
Chris@16
|
19 {
|
Chris@16
|
20 unused_delimiter(Delimiter const& delim)
|
Chris@16
|
21 : delimiter(delim) {}
|
Chris@16
|
22 Delimiter const& delimiter;
|
Chris@16
|
23
|
Chris@16
|
24 private:
|
Chris@16
|
25 // silence MSVC warning C4512: assignment operator could not be generated
|
Chris@16
|
26 unused_delimiter& operator= (unused_delimiter const&);
|
Chris@16
|
27 };
|
Chris@16
|
28
|
Chris@16
|
29 // If a surrounding verbatim[] directive was specified, the current
|
Chris@16
|
30 // delimiter is of the type unused_delimiter. In this case we
|
Chris@16
|
31 // re-activate the delimiter which was active before the verbatim[]
|
Chris@16
|
32 // directive.
|
Chris@16
|
33 template <typename Delimiter, typename Default>
|
Chris@16
|
34 inline Delimiter const&
|
Chris@16
|
35 get_delimiter(unused_delimiter<Delimiter> const& u, Default const&)
|
Chris@16
|
36 {
|
Chris@16
|
37 return u.delimiter;
|
Chris@16
|
38 }
|
Chris@16
|
39
|
Chris@16
|
40 // If no surrounding verbatim[] directive was specified we activate
|
Chris@16
|
41 // a single space as the delimiter to use.
|
Chris@16
|
42 template <typename Delimiter, typename Default>
|
Chris@16
|
43 inline Default const&
|
Chris@16
|
44 get_delimiter(Delimiter const&, Default const& d)
|
Chris@16
|
45 {
|
Chris@16
|
46 return d;
|
Chris@16
|
47 }
|
Chris@16
|
48
|
Chris@16
|
49 }}}}
|
Chris@16
|
50
|
Chris@16
|
51 #endif
|