本文整理汇总了C++中statement::subTokens方法的典型用法代码示例。如果您正苦于以下问题:C++ statement::subTokens方法的具体用法?C++ statement::subTokens怎么用?C++ statement::subTokens使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类statement
的用法示例。
在下文中一共展示了statement::subTokens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indentStatement
QString toSQLParse::indentStatement(statement &stat, int level/*SQLITEMAN, toSyntaxAnalyzer &syntax*/)
{
QString ret;
switch (stat.Type)
{
default:
{
QMessageBox::warning(QApplication::activeWindow(), "Sqliteman",
"toSQLparse: Internal error in toSQLParse, should never get here");
}
case statement::Block:
{
ret = IndentComment(level, 0, stat.Comment, false);
int exc = 0;
for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin();
i != stat.subTokens().end();
i++)
{
int add
= 0;
std::list<toSQLParse::statement>::iterator j = i;
j++;
if (i != stat.subTokens().begin() &&
j != stat.subTokens().end())
add
= Settings.IndentLevel;
else
exc = 0;
QString t;
if ((*i).subTokens().begin() != (*i).subTokens().
end())
t = (*(*i).subTokens().begin()).String.toUpper();
if (t == ("BEGIN") || t == ("WHEN") || t == ("ELSE") || t == ("ELSIF"))
add
= 0;
if ((*i).Type == statement::List)
ret += indentString(level + add
+ exc);
ret += indentStatement(*i, level + add
+ exc/*SQLITEMAN , syntax*/);
if ((*i).Type == statement::List)
{
int i;
for (i = ret.length() - 1;i >= 0 && ret[i].isSpace();i--)
;
ret = ret.mid(0, std::max(i + 1, 0));
ret += ("\n");
ret += indentString(level + exc);
}
if (t == ("EXCEPTION"))
exc = Settings.IndentLevel * 2;
}
if (Settings.EndBlockNewline && level != 0)
ret += ("\n");
}
break;
case statement::List:
case statement::Statement:
int maxlev = 0;
int maxlevorig = 0;
bool useMaxLev = false;
bool any = true;
int current;
bool first;
bool noKeyBreak = false;
bool lineList = false;
QString comment;
if (stat.Type == statement::Statement)
{
ret = IndentComment(level, 0, stat.Comment, false);
useMaxLev = true;
first = true;
current = 0;
}
else
{
for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin();
i != stat.subTokens().end();)
{
if ((*i).Type != statement::Keyword)
noKeyBreak = true;
else
useMaxLev = true;
break;
}
current = level;
first = true;
}
if (useMaxLev)
{
int count = 0;
for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin();
i != stat.subTokens().end();
i++)
{
if (any)
{
QString upp = (*i).String.toUpper();
//.........这里部分代码省略.........