本文整理汇总了C++中parser::DefTokeniser::hasMoreTokens方法的典型用法代码示例。如果您正苦于以下问题:C++ DefTokeniser::hasMoreTokens方法的具体用法?C++ DefTokeniser::hasMoreTokens怎么用?C++ DefTokeniser::hasMoreTokens使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parser::DefTokeniser
的用法示例。
在下文中一共展示了DefTokeniser::hasMoreTokens方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jumpOutOfBrackets
void XData::jumpOutOfBrackets(parser::DefTokeniser& tok, int currentDepth) const
{
while ( tok.hasMoreTokens() && currentDepth > 0)
{
std::string token = tok.nextToken();
if (token == "{")
currentDepth += 1;
else if (token == "}")
currentDepth -= 1;
}
}
示例2: ParseException
Vector4 GuiWindowDef::parseVector4(parser::DefTokeniser& tokeniser)
{
// Collect tokens until all four components are parsed
std::vector<std::string> comp;
while (comp.size() < 4 && tokeniser.hasMoreTokens())
{
std::string token = getExpression(tokeniser);
if (token == ",") continue;
if (token.find(',') != std::string::npos)
{
std::vector<std::string> parts;
boost::algorithm::split(parts, token, boost::algorithm::is_any_of(","));
for (std::size_t i = 0; i < parts.size(); ++i)
{
comp.push_back(boost::algorithm::trim_copy(parts[i]));
}
continue;
}
// TODO: Catch GUI expressions
comp.push_back(token);
}
if (comp.size() != 4)
{
throw parser::ParseException("Couldn't parse Vector4, not enough components found.");
}
return Vector4(string::convert<float>(comp[0]),
string::convert<float>(comp[1]),
string::convert<float>(comp[2]),
string::convert<float>(comp[3]));
}
示例3: getExpression
// Returns a GUI expression, which can be a number, a string or a formula ("gui::objVisible" == 1).
std::string GuiWindowDef::getExpression(parser::DefTokeniser& tokeniser)
{
std::string returnValue = tokeniser.nextToken();
if (returnValue == "(")
{
// Assemble token until closing brace found
std::size_t depth = 1;
while (depth > 0 && tokeniser.hasMoreTokens())
{
std::string token = tokeniser.nextToken();
if (token == ")") depth--;
returnValue += token;
}
}
// Strip quotes
boost::algorithm::trim_if(returnValue, boost::algorithm::is_any_of("\""));
return returnValue;
}
示例4: constructFromTokens
void GuiWindowDef::constructFromTokens(parser::DefTokeniser& tokeniser)
{
// The windowDef keyword has already been parsed, so expect a name plus an opening brace here
name = tokeniser.nextToken();
tokeniser.assertNextToken("{");
while (tokeniser.hasMoreTokens())
{
std::string token = tokeniser.nextToken();
boost::algorithm::to_lower(token);
if (token == "rect")
{
rect = parseVector4(tokeniser);
}
else if (token == "visible")
{
visible = parseBool(tokeniser);
}
else if (token == "notime")
{
notime = parseBool(tokeniser);
}
else if (token == "forecolor")
{
forecolor = parseVector4(tokeniser);
}
else if (token == "backcolor")
{
backcolor = parseVector4(tokeniser);
}
else if (token == "bordercolor")
{
bordercolor = parseVector4(tokeniser);
}
else if (token == "matcolor")
{
matcolor = parseVector4(tokeniser);
}
else if (token == "rotate")
{
rotate = parseFloat(tokeniser);
}
else if (token == "text")
{
setText(parseString(tokeniser));
}
else if (token == "font")
{
font = parseString(tokeniser);
// Cut off the "fonts/" part
boost::algorithm::replace_first(font, "fonts/", "");
}
else if (token == "textscale")
{
textscale = parseFloat(tokeniser);
}
else if (token == "textalign")
{
textalign = parseInt(tokeniser);
}
else if (token == "textalignx")
{
textalignx = parseFloat(tokeniser);
}
else if (token == "textaligny")
{
textaligny = parseFloat(tokeniser);
}
else if (token == "forceaspectwidth")
{
forceaspectwidth = parseFloat(tokeniser);
}
else if (token == "forceaspectheight")
{
forceaspectheight = parseFloat(tokeniser);
}
else if (token == "background")
{
background = parseString(tokeniser);
}
else if (token == "noevents")
{
noevents = parseBool(tokeniser);
}
else if (token == "nocursor")
{
nocursor = parseBool(tokeniser);
}
else if (token == "noclip")
{
noclip = parseBool(tokeniser);
}
else if (token == "nowrap")
{
nowrap = parseBool(tokeniser);
}
else if (token == "modal")
//.........这里部分代码省略.........