本文整理汇总了C++中Row::appendField方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::appendField方法的具体用法?C++ Row::appendField怎么用?C++ Row::appendField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::appendField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: colorize
void SyntaxHighlighter::colorize(QString text)
{
Row *currentRow;
TextField *field = NULL;
enum {IDLE,
MULTI_COMMENT,
SPACES,
WORD, GLOBAL_INCLUDE_FILE, COMMENT1,COMMENT,
STRING,
ESCAPED_CHAR,
INC_STRING
} state = IDLE;
char c = '\n';
char prevC = ' ';
char prevPrevC = ' ';
bool isEscaped = false;
reset();
currentRow = new Row;
m_rows.push_back(currentRow);
for(int i = 0;i < text.size();i++)
{
c = text[i].toLatin1();
// Was the last character an escape?
if(prevC == '\\' && prevPrevC != '\\')
isEscaped = true;
else
isEscaped = false;
prevPrevC = prevC;
prevC = c;
switch(state)
{
case IDLE:
{
if(c == '/')
{
state = COMMENT1;
field = new TextField;
field->m_type = TextField::WORD;
field->m_color = Qt::white;
currentRow->appendField(field);
field->m_text = c;
}
else if(c == ' ' || c == '\t')
{
state = SPACES;
field = new TextField;
field->m_type = TextField::SPACES;
field->m_color = Qt::white;
currentRow->appendField(field);
field->m_text = c;
}
else if(c == '\'')
{
state = ESCAPED_CHAR;
field = new TextField;
field->m_type = TextField::STRING;
currentRow->appendField(field);
field->m_text = c;
}
else if(c == '"')
{
state = STRING;
field = new TextField;
if(currentRow->isCppRow)
field->m_type = TextField::INC_STRING;
else
field->m_type = TextField::STRING;
currentRow->appendField(field);
field->m_text = c;
}
else if(c == '<' && currentRow->isCppRow)
{
// Is it a include string?
bool isIncString = false;
TextField *lastField = currentRow->getLastNonSpaceField();
if(lastField)
{
if(lastField->m_text == "include")
isIncString = true;
}
// Add the field
field = new TextField;
field->m_text = c;
if(isIncString)
{
state = INC_STRING;
field->m_type = TextField::INC_STRING;
}
else
{
field->m_type = TextField::WORD;
field->m_color = Qt::white;
//.........这里部分代码省略.........