2
0
mirror of https://github.com/boostorg/wave.git synced 2026-02-12 00:32:17 +00:00

Wave: Fixed the is_defined() issue.

[SVN r37160]
This commit is contained in:
Hartmut Kaiser
2007-03-08 14:04:37 +00:00
parent eb2fce9150
commit 59415cd026
3 changed files with 33 additions and 11 deletions

View File

@@ -196,10 +196,7 @@ public:
is_predefined); }
template <typename StringT>
bool is_defined_macro(StringT const &str)
{ return macros.is_defined(str.begin(), str.end()); }
template <typename IteratorT2>
bool is_defined_macro(IteratorT2 const &begin, IteratorT2 const &end)
{ return macros.is_defined(begin, end); }
{ return macros.is_defined(str); }
bool get_macro_definition(typename token_type::string_type const &name,
bool &has_params, bool &is_predefined, position_type &pos,
std::vector<token_type> &parameters, token_sequence_type &definition)
@@ -258,6 +255,10 @@ protected:
boost::wave::context<IteratorT, lexer_type, InputPolicyT, HooksT> >;
#endif
template <typename IteratorT2>
bool is_defined_macro(IteratorT2 const &begin, IteratorT2 const &end)
{ return macros.is_defined(begin, end); }
// maintain include paths (helper functions)
bool find_include_file (std::string &s, std::string &d, bool is_system,
char const *current_file) const

View File

@@ -99,8 +99,14 @@ public:
bool is_defined(string_type const &name,
typename defined_macros_type::iterator &it,
defined_macros_type *scope = 0) const;
// expects a token sequence as its parameters
template <typename IteratorT>
bool is_defined(IteratorT const &begin, IteratorT const &end);
// expects an arbitrary string as its parameter
template<typename StringT>
bool is_defined(StringT const &str);
// Get the macro definition for the given macro scope
bool get_macro(string_type const &name, bool &has_parameters,
@@ -393,7 +399,7 @@ token_id id = token_id(*begin);
}
IteratorT it = begin;
string_type name ((*it).get_value().c_str());
string_type name ((*it).get_value());
typename defined_macros_type::iterator cit(current_macros -> find(name));
if (++it != end) {
@@ -405,6 +411,19 @@ typename defined_macros_type::iterator cit(current_macros -> find(name));
return cit != current_macros -> end();
}
///////////////////////////////////////////////////////////////////////////////
// same as above, only takes an arbitrary string type as its parameter
template <typename ContextT>
template<typename StringT>
inline bool
macromap<ContextT>::is_defined(StringT const &str)
{
string_type name (str.c_str());
typename defined_macros_type::iterator cit(current_macros -> find(name));
return cit != current_macros -> end();
}
///////////////////////////////////////////////////////////////////////////////
//
// Get the macro definition for the given macro scope