本文整理汇总了C++中QRegExp::match方法的典型用法代码示例。如果您正苦于以下问题:C++ QRegExp::match方法的具体用法?C++ QRegExp::match怎么用?C++ QRegExp::match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRegExp
的用法示例。
在下文中一共展示了QRegExp::match方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeDocumentation
void GroupDef::writeDocumentation(OutputList &ol)
{
//static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
ol.pushGeneratorState();
startFile(ol,getOutputFileBase(),name(),title,HLI_None);
ol.startHeaderSection();
writeSummaryLinks(ol);
ol.startTitleHead(getOutputFileBase());
ol.pushGeneratorState();
ol.disable(OutputGenerator::Man);
ol.parseText(title);
ol.popGeneratorState();
ol.endTitleHead(getOutputFileBase(),title);
addGroupListToTitle(ol,this);
ol.endHeaderSection();
ol.startContents();
if (Doxygen::searchIndex)
{
Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE);
static QRegExp we("[a-zA-Z_][-a-zA-Z_0-9]*");
int i=0,p=0,l=0;
while ((i=we.match(title,p,&l))!=-1) // foreach word in the title
{
Doxygen::searchIndex->addWord(title.mid(i,l),TRUE);
p=i+l;
}
}
Doxygen::indexList.addIndexItem(this,0,title);
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <compound kind=\"group\">" << endl;
Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
Doxygen::tagFile << " <title>" << convertToXML(title) << "</title>" << endl;
Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl;
}
//---------------------------------------- start flexible part -------------------------------
SrcLangExt lang=getLanguage();
QListIterator<LayoutDocEntry> eli(
LayoutDocManager::instance().docEntries(LayoutDocManager::Group));
LayoutDocEntry *lde;
for (eli.toFirst();(lde=eli.current());++eli)
{
switch (lde->kind())
{
case LayoutDocEntry::BriefDesc:
writeBriefDescription(ol);
break;
case LayoutDocEntry::MemberDeclStart:
startMemberDeclarations(ol);
break;
case LayoutDocEntry::GroupClasses:
{
LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
writeClasses(ol,ls->title(lang));
}
break;
case LayoutDocEntry::GroupInlineClasses:
{
writeInlineClasses(ol);
}
break;
case LayoutDocEntry::GroupNamespaces:
{
LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
writeNamespaces(ol,ls->title(lang));
}
break;
case LayoutDocEntry::MemberGroups:
writeMemberGroups(ol);
break;
case LayoutDocEntry::MemberDecl:
{
LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
writeMemberDeclarations(ol,lmd->type,lmd->title(lang));
}
break;
case LayoutDocEntry::MemberDeclEnd:
endMemberDeclarations(ol);
break;
case LayoutDocEntry::DetailedDesc:
{
LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde;
writeDetailedDescription(ol,ls->title(lang));
}
break;
case LayoutDocEntry::MemberDefStart:
startMemberDocumentation(ol);
break;
case LayoutDocEntry::MemberDef:
{
LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde;
writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
}
//.........这里部分代码省略.........
示例2: setStyle
bool StyleData::setStyle(const char* s, const char* styleName)
{
static const QRegExp subgroup("^{[^}]*}\\s*");
static const QRegExp any_clause("^\\\\[a-z][a-z0-9-]*\\s*");
int len = 0; // length of a particular RTF formatting control
int ref_len = 0; // length of the whole formatting section of a style
int start = s_clause.match(s, 0, &len);
if (start < 0)
{
err("Style sheet '%s' contains no '\\s' clause.\n{%s}\n", styleName, s);
return FALSE;
}
s += start;
index = (int)atol(s + 2); ASSERT(index > 0);
// search for the end of pure formatting codes
const char* end = s + len;
ref_len = len;
bool haveNewDefinition = TRUE;
for(;;)
{
if (*end == '{')
{
// subgroups are used for \\additive
if (0 != subgroup.match(end, 0, &len))
break;
else
{
end += len;
ref_len += len;
}
}
else if (*end == '\\')
{
if (0 == strncmp(end, "\\snext", 6))
break;
if (0 == strncmp(end, "\\sbasedon", 9))
break;
if (0 != any_clause.match(end, 0, &len))
break;
end += len;
ref_len += len;
}
else if (*end == 0)
{ // no style-definition part, keep default value
haveNewDefinition = FALSE;
break;
}
else // plain name without leading \\snext
break;
}
delete[] reference;
reference = new char[ref_len + 1];
memcpy(reference, s, ref_len);
reference[ref_len] = 0;
if (haveNewDefinition)
{
delete[] definition;
size_t size = 1 + strlen(end);
definition = new char[size];
memcpy(definition, end, size);
}
return TRUE;
}