|
Boost Users : |
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-03-20 14:34:05
Ovanes Markarian wrote:
> > I have a question regardning the is_defined_macro member of context
> > type. Is it intended, that this member is non-const? (CVS
> version as
> > well)
Good catch! I'll change that.
> And I just saw that there is no way to retrieve the macro
> value. If I can query if some macro is defined, why can't I
> retrieve its value if it is not a function like macro. The
> other solution would be to implement preprocessing_hooks, but
> I would prefer to have a member function which can retrieve
> this value for me.
There is the function get_macro_definition() allowing to retrieve the
complete set of information about a defined macro. As I recognized just
right now, this is not documented for some reason. So here you go:
Let's assume:
typedef context_type::position_type position_type;
typedef context_type::token_type token_type;
typedef context_type::token_sequence_type token_sequence_type;
get_macro_definition
bool get_macro_definition(
token_type::string_type const &name,
bool &is_function_style,
bool &is_predefined, position_type &pos,
std::vector<token_type> ¶meters,
token_sequence_type &definition);
Where
name:
the name of the macro the information
should be returned for
is_function_style:
will be true if the macro in question
is a function style macro
is_predefined:
will be true if the macro has been predefined
pos:
the position information of the point of
the macro definition
parameters:
the list of names of the parameters this
macro was defined with
definition:
the token sequence containing the macro
definition (body)
The function returns true if the macro was defined and the information has
been successfully retrieved, false otherwise.
I'll add this description to the library documentation asap.
Regards Hartmut
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net