source: NonGTP/Boost/boost/wave/util/pattern_parser.hpp @ 857

Revision 857, 1.9 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]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-2005 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
18///////////////////////////////////////////////////////////////////////////////
19namespace boost {
20namespace wave {
21namespace util {
22
23    ///////////////////////////////////////////////////////////////////////////
24    //
25    //  pattern_and class
26    //
27    ///////////////////////////////////////////////////////////////////////////
28    template <typename CharT = char>
29    struct pattern_and : public boost::spirit::char_parser<pattern_and<CharT> >
30    {
31        pattern_and(CharT pattern_, unsigned long pattern_mask_ = 0UL)
32        :   pattern(pattern_),
33            pattern_mask((0UL != pattern_mask_) ? pattern_mask_ : pattern_)
34        {}
35
36        template <typename T>
37        bool test(T pattern_) const
38        { return (pattern_ & pattern_mask) == pattern; }
39
40        CharT         pattern;
41        unsigned long pattern_mask;
42    };
43
44    template <typename CharT>
45    inline pattern_and<CharT>
46    pattern_p(CharT pattern, unsigned long pattern_mask = 0UL)
47    { return pattern_and<CharT>(pattern, pattern_mask); }
48
49
50///////////////////////////////////////////////////////////////////////////////
51}   // namespace util
52}   // namespace wave
53}   // namespace boost
54
55#endif // defined(BOOST_SPIRIT_PATTERN_PARSER_HPP)
Note: See TracBrowser for help on using the repository browser.