本文整理汇总了C++中QRegularExpressionMatchIterator::peekNext方法的典型用法代码示例。如果您正苦于以下问题:C++ QRegularExpressionMatchIterator::peekNext方法的具体用法?C++ QRegularExpressionMatchIterator::peekNext怎么用?C++ QRegularExpressionMatchIterator::peekNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRegularExpressionMatchIterator
的用法示例。
在下文中一共展示了QRegularExpressionMatchIterator::peekNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isLineMatchingBackward
bool QuickFindPattern::isLineMatchingBackward(
const QString& line, int column ) const
{
int pos = 0;
if ( ! active_ )
return false;
QRegularExpressionMatchIterator matches = regexp_.globalMatch(line);
QRegularExpressionMatch lastMatch;
while ( matches.hasNext() ) {
QRegularExpressionMatch nextMatch = matches.peekNext();
if ( column >= 0 && nextMatch.capturedEnd() >= column ) {
break;
}
lastMatch = matches.next();
}
if ( lastMatch.hasMatch() ) {
lastMatchStart_ = lastMatch.capturedStart();
lastMatchEnd_ = lastMatch.capturedEnd() - 1;
return true;
}
else {
return false;
}
}
示例2: loadSfz
bool ZInstrument::loadSfz(const QString& s)
{
_program = 0;
QFile f(s);
if (!f.open(QIODevice::ReadOnly)) {
qDebug("ZInstrument: cannot load %s", qPrintable(s));
return false;
}
QFileInfo fi(f);
QString path = fi.absolutePath();
qint64 total = fi.size();
QString sample;
SfzRegion r;
SfzRegion g; // group
r.init(path);
g.init(path);
bool groupMode = false;
zerberus->setLoadProgress(0);
while (!f.atEnd()) {
QByteArray ba = f.readLine();
zerberus->setLoadProgress(((qreal)f.pos() * 100) / total);
ba = ba.simplified();
if (ba.isEmpty() || ba.startsWith("//"))
continue;
if (zerberus->loadWasCanceled())
return false;
if (ba.startsWith("<group>")) {
if (!groupMode && !r.isEmpty())
addRegion(r);
g.init(path);
r.init(path);
groupMode = true;
ba = ba.mid(7);
}
else if (ba.startsWith("<region>")) {
if (groupMode) {
g = r;
groupMode = false;
}
else {
if (!r.isEmpty())
addRegion(r);
r = g; // initialize next region with group values
}
ba = ba.mid(8);
}
QRegularExpression re("\\s?(\\w+)=");
QRegularExpressionMatchIterator i = re.globalMatch(ba);
while (i.hasNext()) {
QRegularExpressionMatch match = i.next();
int si = match.capturedEnd();
int ei;
if (i.hasNext()) {
QRegularExpressionMatch nextMatch = i.peekNext();
ei = nextMatch.capturedStart();
}
else
ei = ba.size();
QString s = ba.mid(si, ei-si);
r.readOp(match.captured(1), s);
}
}
zerberus->setLoadProgress(100);
if (!groupMode && !r.isEmpty())
addRegion(r);
return true;
}
示例3: loadSfz
//.........这里部分代码省略.........
for (QString newFileLine : newFileContents) {
fileContents.insert(idx+offset, newFileLine);
offset++;
}
fileContents.removeAt(idx);
}
}
else if (curLine.isEmpty())
fileContents.removeAt(idx);
else
idx++;
}
int total = fileContents.size();
SfzRegion r;
SfzRegion g; // group
SfzRegion glob;
r.init(path);
g.init(path);
glob.init(path);
bool groupMode = false;
bool globMode = false;
zerberus->setLoadProgress(0);
for (int idx = 0; idx < fileContents.size(); idx++) {
QString curLine = fileContents[idx];
zerberus->setLoadProgress(((qreal) idx * 100) / (qreal) total);
if (zerberus->loadWasCanceled())
return false;
if (curLine.startsWith("<global>")) {
if (!globMode && !groupMode && !r.isEmpty())
addRegion(r);
glob.init(path);
g.init(path); // global also resets group
r.init(path);
globMode = true;
}
if (curLine.startsWith("<group>")) {
if (!groupMode && !globMode && !r.isEmpty())
addRegion(r);
g.init(path);
if (globMode) {
glob = r;
globMode = false;
}
else {
r = glob; // initialize group with global values
}
groupMode = true;
curLine = curLine.mid(7);
}
else if (curLine.startsWith("<region>")) {
if (groupMode) {
g = r;
groupMode = false;
}
else if (globMode) {
glob = r;
g = glob;
globMode = false;
}
else {
if (!r.isEmpty())
addRegion(r);
r = g; // initialize next region with group values
}
curLine = curLine.mid(8);
}
else if (curLine.startsWith("<control>"))
c.init();
QRegularExpression re("\\s?([\\w\\$]+)="); // defines often use the $-sign
QRegularExpressionMatchIterator i = re.globalMatch(curLine);
while (i.hasNext()) {
QRegularExpressionMatch match = i.next();
int si = match.capturedEnd();
int ei;
if (i.hasNext()) {
QRegularExpressionMatch nextMatch = i.peekNext();
ei = nextMatch.capturedStart();
}
else
ei = curLine.size();
QString s = curLine.mid(si, ei-si);
r.readOp(match.captured(1), s, c);
}
}
for (int i = 0; i < 128; i++)
_setcc[i] = c.set_cc[i];
zerberus->setLoadProgress(100);
if (!groupMode && !globMode && !r.isEmpty())
addRegion(r);
return true;
}