本文整理汇总了C++中document::Ptr::macroUses方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::macroUses方法的具体用法?C++ Ptr::macroUses怎么用?C++ Ptr::macroUses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类document::Ptr
的用法示例。
在下文中一共展示了Ptr::macroUses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matchMacroInUse
bool CppElementEvaluator::matchMacroInUse(const Document::Ptr &document, unsigned pos)
{
foreach (const Document::MacroUse &use, document->macroUses()) {
if (use.containsUtf16charOffset(pos)) {
const unsigned begin = use.utf16charsBegin();
if (pos < begin + use.macro().nameToQString().size()) {
m_element = QSharedPointer<CppElement>(new CppMacro(use.macro()));
return true;
}
}
}
return false;
}
示例2: use
QFuture<TextEditor::HighlightingResult> CppHighlightingSupportInternal::highlightingFuture(
const Document::Ptr &doc,
const Snapshot &snapshot) const
{
typedef TextEditor::HighlightingResult Result;
QList<Result> macroUses;
// Get macro definitions
foreach (const CPlusPlus::Macro& macro, doc->definedMacros()) {
int line, column;
editor()->convertPosition(macro.offset(), &line, &column);
++column; //Highlighting starts at (column-1) --> compensate here
Result use(line, column, macro.name().size(), MacroUse);
macroUses.append(use);
}
// Get macro uses
foreach (const Document::MacroUse ¯o, doc->macroUses()) {
const QString name = QString::fromUtf8(macro.macro().name());
//Filter out QtKeywords
if (isQtKeyword(QStringRef(&name)))
continue;
//Filter out C++ keywords
SimpleLexer tokenize;
tokenize.setQtMocRunEnabled(false);
tokenize.setObjCEnabled(false);
tokenize.setCxx0xEnabled(true);
const QList<Token> tokens = tokenize(name);
if (tokens.length() && (tokens.at(0).isKeyword() || tokens.at(0).isObjCAtKeyword()))
continue;
int line, column;
editor()->convertPosition(macro.begin(), &line, &column);
++column; //Highlighting starts at (column-1) --> compensate here
Result use(line, column, name.size(), MacroUse);
macroUses.append(use);
}
LookupContext context(doc, snapshot);
return CheckSymbols::go(doc, context, macroUses);
}