1 | /** \file ParserTypes.hpp
|
---|
2 | *
|
---|
3 | * date: Sep, 27 2011
|
---|
4 | * author: heber
|
---|
5 | *
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef PARSERTYPES_HPP_
|
---|
9 | #define PARSERTYPES_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <cstddef>
|
---|
17 |
|
---|
18 | #include <boost/preprocessor/seq/elem.hpp>
|
---|
19 | #include <boost/preprocessor/seq/seq.hpp>
|
---|
20 | #include <boost/preprocessor/seq/size.hpp>
|
---|
21 | #include <boost/preprocessor/iteration/local.hpp>
|
---|
22 |
|
---|
23 |
|
---|
24 | #include "ParserTypes.def"
|
---|
25 |
|
---|
26 | //!> function to print each member of the sequence in the enumeration
|
---|
27 | #define sequence_print(z,n,seq) \
|
---|
28 | BOOST_PP_SEQ_ELEM(n, seq) ,
|
---|
29 |
|
---|
30 | //!> Enumeration of all known parsers
|
---|
31 | enum ParserTypes {
|
---|
32 | // some proprocessor magic to generate the body from the above sequence
|
---|
33 | #if defined ParserTypes_END // do we have parameters at all?
|
---|
34 | #define BOOST_PP_LOCAL_MACRO(n) sequence_print(~, n, PARSERSEQUENCE)
|
---|
35 | #define BOOST_PP_LOCAL_LIMITS (0, ParserTypes_END-1)
|
---|
36 | #include BOOST_PP_LOCAL_ITERATE()
|
---|
37 | #undef BOOST_PP_LOCAL_MACRO
|
---|
38 | #undef BOOST_PP_LOCAL_LIMITS
|
---|
39 | #endif
|
---|
40 | ParserTypes_end = ParserTypes_END,
|
---|
41 | ParserTypes_begin = BOOST_PP_SEQ_HEAD(PARSERSEQUENCE)
|
---|
42 | };
|
---|
43 |
|
---|
44 | #undef sequence_print
|
---|
45 |
|
---|
46 | //!> Number of known ParserTypes
|
---|
47 | const size_t ParserTypesMax = ParserTypes_END;
|
---|
48 |
|
---|
49 | #include "ParserTypes.undef"
|
---|
50 |
|
---|
51 | //!> Typedef for enumeration to ease its use
|
---|
52 | typedef enum ParserTypes ParserTypes;
|
---|
53 |
|
---|
54 | /** Increment operator for the enumeration ParserTypes to allow loops.
|
---|
55 | * \param &type value
|
---|
56 | * \return value incremented by one
|
---|
57 | */
|
---|
58 | ParserTypes &operator++(ParserTypes &type);
|
---|
59 |
|
---|
60 | #endif /* PARSERTYPES_HPP_ */
|
---|
61 |
|
---|