本文整理汇总了C++中VariableList::rend方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableList::rend方法的具体用法?C++ VariableList::rend怎么用?C++ VariableList::rend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableList
的用法示例。
在下文中一共展示了VariableList::rend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool
EngineParser::getTypeNameAndScopeByToken (ExpressionResult &result,
string &token,
string &op,
const string& full_file_path,
unsigned long linenum,
const string& above_text,
string &out_type_name,
string &out_type_scope)
{
if (result.m_isaType)
{
DEBUG_PRINT ("*** Found a cast expression");
/*
* Handle type (usually when casting is found)
*/
if (result.m_isPtr && op == ".")
{
DEBUG_PRINT ("Did you mean to use '->' instead of '.' ?");
return false;
}
if (!result.m_isPtr && op == "->")
{
DEBUG_PRINT ("Can not use '->' operator on a non pointer object");
return false;
}
out_type_scope = result.m_scope.empty() ? "" : result.m_scope.c_str();
out_type_name = result.m_name.c_str();
return true;
}
else if (result.m_isThis)
{
DEBUG_PRINT ("*** Found 'this'");
/* special handle for 'this' keyword */
if (op == "::")
{
DEBUG_PRINT ("'this' can not be used with operator ::");
return false;
}
if (result.m_isPtr && op == ".")
{
DEBUG_PRINT ("Did you mean to use '->' instead of '.' ?");
return false;
}
if (!result.m_isPtr && op == "->")
{
DEBUG_PRINT ("Can not use '->' operator on a non pointer object");
return false;
}
/* reaching this point we are quite sure that the easiest tests about "this"
* calling are passed. Go on finding for the first symbol of type class that
* is reachable through the scopes chain.
*/
/* will we find a good class scope? */
out_type_scope = result.m_scope.empty() ? "" : result.m_scope.c_str();
out_type_name = "";
getNearestClassInCurrentScopeChainByFileLine (full_file_path.c_str (), linenum, out_type_name);
if (out_type_name.empty ())
{
DEBUG_PRINT ("'this' has not a type name");
return false;
}
return true;
}
else if (op == "::")
{
out_type_name = token;
out_type_scope = result.m_scope.empty() ? "" : result.m_scope.c_str();
return true;
}
else
{
/*
* Found an identifier (can be a local variable, a global one etc)
*/
DEBUG_PRINT ("*** Found an identifier or local variable...");
/* optimize scope'll clear the scopes leaving the local variables */
string optimized_scope = optimizeScope(above_text);
VariableList li;
std::map<std::string, std::string> ignoreTokens;
get_variables(optimized_scope, li, ignoreTokens, false);
/* here the trick is to start from the end of the found variables
* up to the begin. This because the local variable declaration should be found
* just above to the statement line
*/
for (VariableList::reverse_iterator iter = li.rbegin(); iter != li.rend(); iter++)
{
Variable var = (*iter);
//.........这里部分代码省略.........