os/ossrv/ossrv_pub/boost_apis/boost/spirit/meta/fundamental.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*=============================================================================
sl@0
     2
    Copyright (c) 2002-2003 Hartmut Kaiser
sl@0
     3
    http://spirit.sourceforge.net/
sl@0
     4
sl@0
     5
    Use, modification and distribution is subject to the Boost Software
sl@0
     6
    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0
     7
    http://www.boost.org/LICENSE_1_0.txt)
sl@0
     8
=============================================================================*/
sl@0
     9
#if !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)
sl@0
    10
#define BOOST_SPIRIT_FUNDAMENTAL_HPP
sl@0
    11
sl@0
    12
#include <boost/spirit/meta/impl/fundamental.ipp>
sl@0
    13
sl@0
    14
namespace boost { namespace spirit 
sl@0
    15
{
sl@0
    16
    ///////////////////////////////////////////////////////////////////////////
sl@0
    17
    //
sl@0
    18
    //  Helper template for counting the number of nodes contained in a
sl@0
    19
    //  given parser type.
sl@0
    20
    //  All parser_category type parsers are counted as nodes.
sl@0
    21
    //
sl@0
    22
    ///////////////////////////////////////////////////////////////////////////
sl@0
    23
    template <typename ParserT>
sl@0
    24
    struct node_count {
sl@0
    25
sl@0
    26
        typedef typename ParserT::parser_category_t parser_category_t;
sl@0
    27
        typedef typename impl::nodes<parser_category_t>
sl@0
    28
            ::template count<ParserT, mpl::int_<0> > count_t;
sl@0
    29
sl@0
    30
        BOOST_STATIC_CONSTANT(int, value = count_t::value);
sl@0
    31
    };
sl@0
    32
sl@0
    33
    ///////////////////////////////////////////////////////////////////////////
sl@0
    34
    //
sl@0
    35
    //  Helper template for counting the number of leaf nodes contained in a
sl@0
    36
    //  given parser type.
sl@0
    37
    //  Only plain_parser_category type parsers are counted as leaf nodes.
sl@0
    38
    //
sl@0
    39
    ///////////////////////////////////////////////////////////////////////////
sl@0
    40
    template <typename ParserT>
sl@0
    41
    struct leaf_count {
sl@0
    42
sl@0
    43
        typedef typename ParserT::parser_category_t parser_category_t;
sl@0
    44
        typedef typename impl::leafs<parser_category_t>
sl@0
    45
            ::template count<ParserT, mpl::int_<0> > count_t;
sl@0
    46
sl@0
    47
        BOOST_STATIC_CONSTANT(int, value = count_t::value);
sl@0
    48
    };
sl@0
    49
sl@0
    50
}} // namespace boost::spirit
sl@0
    51
sl@0
    52
#endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP)