本文整理汇总了C++中qstringlist::iterator::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::contains方法的具体用法?C++ iterator::contains怎么用?C++ iterator::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::iterator
的用法示例。
在下文中一共展示了iterator::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ensureAbookPath
void AbookAddressbook::ensureAbookPath()
{
if (!QDir::home().exists(".abook")) {
QDir::home().mkdir(".abook");
}
QDir abook(QDir::homePath() + "/.abook/");
QStringList abookrc;
QFile file(QDir::homePath() + "/.abook/abookrc");
if (file.exists() && file.open(QIODevice::ReadWrite|QIODevice::Text)) {
abookrc = QString::fromLocal8Bit(file.readAll()).split('\n');
bool havePhoto = false;
for (QStringList::iterator it = abookrc.begin(), end = abookrc.end(); it != end; ++it) {
if (it->contains("preserve_fields"))
*it = "set preserve_fields=all";
else if (it->contains("photo") && it->contains("field"))
havePhoto = true;
}
if (!havePhoto)
abookrc << "field photo = Photo";
} else {
abookrc << "field photo = Photo" << "set preserve_fields=all";
file.open(QIODevice::WriteOnly|QIODevice::Text);
}
if (file.isOpen()) {
if (file.isWritable()) {
file.seek(0);
file.write(abookrc.join("\n").toLocal8Bit());
}
file.close();
}
}
示例2: makeBatch
void EditorInterface::makeBatch(QString& batchFileName)
{
FNTRACE("", "EditorInterface", "batchFileName", batchFileName);
if (batchFileName.endsWith(".bat", Qt::CaseInsensitive))
fileName = batchFileName.left(batchFileName.length()-4);
else
fileName = batchFileName;
makeRelativePaths();
batchFileName = fileName+".bat";
QString debugFileName = fileName + "_debug.txt";
QStringList args = makeArgs();
QFile batchFile(batchFileName);
if (!batchFile.open(QIODevice::WriteOnly | QIODevice::Text))
ETHROW(Exception(QString("Failed to open %1 for writing").arg(batchFileName)));
QTextStream batch(&batchFile);
batch << "@echo off\n";
if (QDir::drives().size()>1)
batch << editorDir.absolutePath().left(2) << "\n";
batch << "cd \"" << editorDir.absolutePath() << "\"\n" << editorName;
for (QStringList::iterator arg = args.begin(); arg != args.end(); ++arg)
{
batch << ' ';
if (arg->contains(' '))
batch << '"'+(*arg)+'"';
else
batch << (*arg);
}
batch << " > \"" << debugFileName << "\"\n"
"If ERRORLEVEL 0 goto DONE\n"
"pause\n"
":DONE\n";
}