Hello Hartmut, 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) With Kind Regards, Ovanes
On Tue, March 20, 2007 18:40, Ovanes Markarian wrote:
Hello Hartmut,
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)
With Kind Regards,
Ovanes _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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. With Kind Regards, Ovanes
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
get_macro_definition
[snip]
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
Many thanks for the answer. If I correctly understand you I can call this function without any need to previously call is_defined_macro? If the macro is not defined it will return false as well... Is it correct? Thanks, Ovanes _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Hartmut Kaiser
-
Ovanes Markarian