本文整理汇总了C++中qstringlist::const_iterator::compare方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::compare方法的具体用法?C++ const_iterator::compare怎么用?C++ const_iterator::compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::compare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testGridShiftFileAvailability
bool QgsDatumTransformDialog::testGridShiftFileAvailability( QTreeWidgetItem* item, int col ) const
{
if ( !item )
{
return false;
}
QString itemText = item->text( col );
if ( itemText.isEmpty() )
{
return false;
}
char* projLib = getenv( "PROJ_LIB" );
if ( !projLib ) //no information about installation directory
{
item->setToolTip( col, tr( "The PROJ_LIB enviroment variable not set." ) );
return false;
}
QStringList itemEqualSplit = itemText.split( "=" );
QString filename;
for ( int i = 1; i < itemEqualSplit.size(); ++i )
{
if ( i > 1 )
{
filename.append( "=" );
}
filename.append( itemEqualSplit.at( i ) );
}
QDir projDir( projLib );
if ( projDir.exists() )
{
//look if filename in directory
QStringList fileList = projDir.entryList();
QStringList::const_iterator fileIt = fileList.constBegin();
for ( ; fileIt != fileList.constEnd(); ++fileIt )
{
#if defined(Q_OS_WIN)
if ( fileIt->compare( filename, Qt::CaseInsensitive ) == 0 )
#else
if ( fileIt->compare( filename ) == 0 )
#endif //Q_OS_WIN
{
return true;
}
}
item->setToolTip( col, tr( "File '%1' not found in directory '%2'" ).arg( filename ).arg( projDir.absolutePath() ) );
return false; //not found in PROJ_LIB directory
}
item->setToolTip( col, tr( "The directory '%1' set to PROJ_LIB variable doesn't exist" ).arg( projDir.absolutePath() ) );
return false;
}
示例2: main
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QStringList argList = a.arguments();
if (argList.count() <= 0) {
return -1; // should at least have command name
}
SkString input;
QStringList::const_iterator iter = argList.begin();
SkString commandName(iter->toAscii().data());
++iter; // skip the command name
for ( ; iter != argList.end(); ++iter) {
if (0 == iter->compare("--help") || 0 == iter->compare("-h")) {
usage(commandName.c_str());
return -1;
} else if (input.isEmpty()) {
input = SkString(iter->toAscii().data());
} else {
usage(commandName.c_str());
return -1;
}
}
SkDebuggerGUI w;
if (!input.isEmpty()) {
if (SkStrEndsWith(input.c_str(), ".skp")) {
w.openFile(input.c_str());
} else {
w.setupDirectoryWidget(input.c_str());
}
}
w.show();
return a.exec();
}