]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/spirit/home/qi/detail/unused_skipper.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / spirit / home / qi / detail / unused_skipper.hpp
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_QI_UNUSED_SKIPPER_JUL_25_2009_0921AM)
7 #define BOOST_SPIRIT_QI_UNUSED_SKIPPER_JUL_25_2009_0921AM
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 qi { namespace detail
16 {
17     template <typename Skipper>
18     struct unused_skipper : unused_type
19     {
20         unused_skipper(Skipper const& skipper)
21           : skipper(skipper) {}
22         Skipper const& skipper;
23
24     private:
25         // silence MSVC warning C4512: assignment operator could not be generated
26         unused_skipper& operator= (unused_skipper const&);
27     };
28
29     // If a surrounding lexeme[] directive was specified, the current
30     // skipper is of the type unused_skipper. In this case we 
31     // re-activate the skipper which was active before the skip[]
32     // directive.
33     template <typename Skipper>
34     inline Skipper const& 
35     get_skipper(unused_skipper<Skipper> const& u)
36     {
37         return u.skipper;
38     }
39
40     // If no surrounding lexeme[] directive was specified we keep what we got.
41     template <typename Skipper>
42     inline Skipper const& 
43     get_skipper(Skipper const& u)
44     {
45         return u;
46     }
47
48 }}}}
49
50 #endif