本文整理汇总了C++中ParseNode::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ParseNode::isValid方法的具体用法?C++ ParseNode::isValid怎么用?C++ ParseNode::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseNode
的用法示例。
在下文中一共展示了ParseNode::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRegisterText
QString RegisterPane::getRegisterText(int registerNo) {
unsigned int value = m_registerLabels[registerNo]->getValue();
QString alias = ::getRegisterText(registerNo, true);
QString regName = ((registerNo >= 32) ?
QString("<b>%1</b>").arg(alias) :
QString("<b>r%1</b> (%2)").arg(QString::number(registerNo), alias));
QString mText = QString(
"<span style=\"font-size: 12;\">%1</span>"
"<pre>").arg(regName);
if (value == 0)
mText += QString("Value = 0");
else {
QString one = getNoInBase(value, 16),
// two = getNoInBase(value, 2),
three = getNoInBase((signed)value, -10),//D_SIGNED_DECIMAL),
four = getNoInBase(value, 10);
mText += QString(
"Hex: %1<br>"
// "Binary: %2<br>"
"Decimal: %2")
.arg(one, /*two, */three);
if (three != four)
mText += QString("<br>UDecimal: %1").arg(four);
}
// Display the line which is responsible for setting
// the value currently in this register.
ParseNode *lastModified = m_registerLabels[registerNo]->m_lastModified;
TextEditor *active = NULL;
if (lastModified != NULL && lastModified->isValid() && lastModified->getTextBlock() != NULL && (active = m_parent->m_gui->getActiveProgram()) != NULL) {
mText += QString("<br>"
"(Set by line <i>%1</i>)").arg(1 + active->lineNumber(*lastModified->getTextBlock()));
}
mText += QString("</pre>");
return mText;
}
示例2: updateDisplay
void StackView::updateDisplay(State *s, int state) {
if (m_dirty && state != RUNNING) {
s->getStack(m_stack);
int cur_index = 0, size = m_stack.size();
const unsigned int base = 16; // hex
const QString &longestAddr = QString::number(STACK_BASE_ADDRESS - 4, base);
const int maxAddrLength = longestAddr.length();
m_display->setUpdatesEnabled(false);
m_display->setPlainText("");
QString text;
unsigned int address = STACK_BASE_ADDRESS - 4;
foreach(int value, m_stack) {
QString addr = QString::number(address, base);
for(int max = addr.length(), i = maxAddrLength; i > max; i--)
addr += " ";
const QString &valString = QString::number(value, base);
text = QString(": %1\n").arg(valString);
QTextCursor c = m_display->textCursor();
c.movePosition(QTextCursor::End);
//int oldEnd = c.position();
QTextCharFormat format(m_display->currentCharFormat());
if (cur_index++ > 200) {
if (VERBOSE)
cerr << "STACK_SIZE: " << m_stack.size() << endl;
c.insertText(QString("... STACK IS TOO LARGE TO DISPLAY ...\n"
"You may be in an infinite loop. Stack size: %1 words").arg(QString::number(size)));
/*QMessageBox::warning(this, tr("Stack warning"),
QString("Stack is too large to display.\n"
"You may be in an infinite loop. Stack size: %1 words").arg(QString::number(size)));*/
break;
}
// TODO: Have tip tell which line last modified it!
QString tip = QString("Hex: %1: %2<br>"
"Dec: %3: %4").arg(addr, valString,
QString::number(address, 10),
QString::number(value, 10));
if (address == m_sp) {
format.setFontWeight(100);
tip += "<br>(<b>$sp</b>)";
}
if (m_modifiedMap.contains(address)) {
ParseNode *last = m_modifiedMap[address];
TextEditor *active = NULL;
if (last != NULL && last->isValid() && last->getTextBlock() != NULL && (active = m_gui->getActiveProgram()) != NULL) {
tip += QString("<br>"
"(Set by line <i>%1</i>)").arg(1 + active->lineNumber(*last->getTextBlock()));
}
}
format.setToolTip(tip);
c.insertText(addr, format);
if (address == m_sp)
format.setFontWeight(50);
c.insertText(text, format);
address -= 4;
}