~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/spirit/core/meta/fundamental.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=============================================================================
 
2
    Spirit v1.6.1
 
3
    Copyright (c) 2002-2003 Hartmut Kaiser
 
4
    http://spirit.sourceforge.net/
 
5
 
 
6
    Permission to copy, use, modify, sell and distribute this software is
 
7
    granted provided this copyright notice appears in all copies. This
 
8
    software is provided "as is" without express or implied warranty, and
 
9
    with no claim as to its suitability for any purpose.
 
10
=============================================================================*/
 
11
#if !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)
 
12
#define BOOST_SPIRIT_FUNDAMENTAL_HPP
 
13
 
 
14
///////////////////////////////////////////////////////////////////////////////
 
15
#include "boost/spirit/core/meta/impl/fundamental.ipp"
 
16
 
 
17
///////////////////////////////////////////////////////////////////////////////
 
18
namespace boost { namespace spirit {
 
19
 
 
20
///////////////////////////////////////////////////////////////////////////////
 
21
//
 
22
//  Helper template for counting the number of nodes contained in a
 
23
//  given parser type.
 
24
//  All parser_category type parsers are counted as nodes.
 
25
//
 
26
///////////////////////////////////////////////////////////////////////////////
 
27
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)
 
28
 
 
29
template <typename ParserT>
 
30
struct node_count {
 
31
 
 
32
    typedef typename ParserT::parser_category_t parser_category_t;
 
33
    typedef impl::nodes<parser_category_t> nodes_t;
 
34
 
 
35
    typedef typename impl::count_wrapper<nodes_t>
 
36
        ::template result_<ParserT, mpl::int_<0> > count_t;
 
37
 
 
38
    BOOST_STATIC_CONSTANT(int, value = count_t::value);
 
39
};
 
40
 
 
41
#else
 
42
 
 
43
template <typename ParserT>
 
44
struct node_count {
 
45
 
 
46
    typedef typename ParserT::parser_category_t parser_category_t;
 
47
    typedef typename impl::nodes<parser_category_t>
 
48
        ::template count<ParserT, mpl::int_<0> > count_t;
 
49
 
 
50
    BOOST_STATIC_CONSTANT(int, value = count_t::value);
 
51
};
 
52
 
 
53
#endif
 
54
 
 
55
///////////////////////////////////////////////////////////////////////////////
 
56
//
 
57
//  Helper template for counting the number of leaf nodes contained in a
 
58
//  given parser type.
 
59
//  Only plain_parser_category type parsers are counted as leaf nodes.
 
60
//
 
61
///////////////////////////////////////////////////////////////////////////////
 
62
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)
 
63
 
 
64
template <typename ParserT>
 
65
struct leaf_count {
 
66
 
 
67
    typedef typename ParserT::parser_category_t parser_category_t;
 
68
    typedef impl::leafs<parser_category_t> nodes_t;
 
69
 
 
70
    typedef typename impl::count_wrapper<nodes_t>
 
71
        ::template result_<ParserT, mpl::int_<0> > count_t;
 
72
 
 
73
    BOOST_STATIC_CONSTANT(int, value = count_t::value);
 
74
};
 
75
 
 
76
#else
 
77
 
 
78
template <typename ParserT>
 
79
struct leaf_count {
 
80
 
 
81
    typedef typename ParserT::parser_category_t parser_category_t;
 
82
    typedef typename impl::leafs<parser_category_t>
 
83
        ::template count<ParserT, mpl::int_<0> > count_t;
 
84
 
 
85
    BOOST_STATIC_CONSTANT(int, value = count_t::value);
 
86
};
 
87
 
 
88
#endif
 
89
 
 
90
///////////////////////////////////////////////////////////////////////////////
 
91
}} // namespace boost::spirit
 
92
 
 
93
#endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)