• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Boost.Wave: A Standard compliant C++ preprocessor library
3 
4     Global application configuration
5 
6     http://www.boost.org/
7 
8     Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
9     Software License, Version 1.0. (See accompanying file
10     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 =============================================================================*/
12 
13 #if !defined(BOOST_SPIRIT_PATTERN_PARSER_HPP)
14 #define BOOST_SPIRIT_PATTERN_PARSER_HPP
15 
16 #include <boost/spirit/include/classic_primitives.hpp>
17 #include <boost/wave/wave_config.hpp>
18 
19 // this must occur after all of the includes and before any code appears
20 #ifdef BOOST_HAS_ABI_HEADERS
21 #include BOOST_ABI_PREFIX
22 #endif
23 
24 ///////////////////////////////////////////////////////////////////////////////
25 namespace boost {
26 namespace wave {
27 namespace util {
28 
29     ///////////////////////////////////////////////////////////////////////////
30     //
31     //  pattern_and class
32     //
33     ///////////////////////////////////////////////////////////////////////////
34     template <typename CharT = char>
35     struct pattern_and
36       : public boost::spirit::classic::char_parser<pattern_and<CharT> >
37     {
pattern_andboost::wave::util::pattern_and38         pattern_and(CharT pattern_, unsigned long pattern_mask_ = 0UL)
39         :   pattern(pattern_),
40             pattern_mask((0UL != pattern_mask_) ?
41                 pattern_mask_ : (unsigned long)pattern_)
42         {}
43 
44         template <typename T>
testboost::wave::util::pattern_and45         bool test(T pattern_) const
46         { return ((unsigned long)pattern_ & pattern_mask) == (unsigned long)pattern; }
47 
48         CharT         pattern;
49         unsigned long pattern_mask;
50     };
51 
52     template <typename CharT>
53     inline pattern_and<CharT>
pattern_p(CharT pattern,unsigned long pattern_mask=0UL)54     pattern_p(CharT pattern, unsigned long pattern_mask = 0UL)
55     { return pattern_and<CharT>(pattern, pattern_mask); }
56 
57 ///////////////////////////////////////////////////////////////////////////////
58 }   // namespace util
59 }   // namespace wave
60 }   // namespace boost
61 
62 // the suffix header occurs after all of the code
63 #ifdef BOOST_HAS_ABI_HEADERS
64 #include BOOST_ABI_SUFFIX
65 #endif
66 
67 #endif // defined(BOOST_SPIRIT_PATTERN_PARSER_HPP)
68