Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/wave/util/pattern_parser.hpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.1 KB
Line 
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-2007 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/core/primitives/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///////////////////////////////////////////////////////////////////////////////
25namespace boost {
26namespace wave {
27namespace util {
28
29    ///////////////////////////////////////////////////////////////////////////
30    //
31    //  pattern_and class
32    //
33    ///////////////////////////////////////////////////////////////////////////
34    template <typename CharT = char>
35    struct pattern_and : public boost::spirit::char_parser<pattern_and<CharT> >
36    {
37        pattern_and(CharT pattern_, unsigned long pattern_mask_ = 0UL)
38        :   pattern(pattern_), 
39            pattern_mask((0UL != pattern_mask_) ? pattern_mask_ : pattern_)
40        {}
41
42        template <typename T>
43        bool test(T pattern_) const
44        { return ((unsigned long)pattern_ & pattern_mask) == (unsigned long)pattern; }
45
46        CharT         pattern;
47        unsigned long pattern_mask;
48    };
49
50    template <typename CharT>
51    inline pattern_and<CharT>
52    pattern_p(CharT pattern, long pattern_mask = 0L)
53    { return pattern_and<CharT>(pattern, (unsigned long)pattern_mask); }
54
55///////////////////////////////////////////////////////////////////////////////
56}   // namespace util
57}   // namespace wave
58}   // namespace boost
59
60// the suffix header occurs after all of the code
61#ifdef BOOST_HAS_ABI_HEADERS
62#include BOOST_ABI_SUFFIX
63#endif
64
65#endif // defined(BOOST_SPIRIT_PATTERN_PARSER_HPP)
Note: See TracBrowser for help on using the repository browser.