本文整理汇总了C++中QStringRef::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringRef::count方法的具体用法?C++ QStringRef::count怎么用?C++ QStringRef::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringRef
的用法示例。
在下文中一共展示了QStringRef::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equal
bool equal(const QStringRef &word1,const QStringRef &word2) // is diacritics tolerant
{
//qDebug() << word1<<"-"<<word2;
int length1=word1.count();
int length2=word2.count();
int i1=-1,i2=-1;
QList<QChar> diacritics1,diacritics2;
QChar letter1,letter2;
while (i1+1<length1 && i2+1<length2)
{
i1++;
i2++;
diacritics1.clear();
diacritics2.clear();
while (i1<length1 && isDiacritic(word1.at(i1)))
{
if (word1.at(i1)!=shadde && word1.at(i1)!=aleft_superscript)
diacritics1.append(word1.at(i1));
i1++;
}
if (i1<length1)
letter1=word1.at(i1);
else
letter1='\0';
while (i2<length2 && isDiacritic(word2.at(i2)))
{
if (word2.at(i2)!=shadde && word2.at(i2)!=aleft_superscript)
diacritics2.append(word2.at(i2));
i2++;
}
if (i2<length2)
letter2=word2.at(i2);
else
letter2='\0';
//now comparison first diacritics then next_letter
if (diacritics1.count()==0 || diacritics2.count()==0 || equal_strict(diacritics1,diacritics2))
{
if (equal(letter1,letter2))
continue;
else
return false;
}
return false;
}
if (length1-(i1+1)==0 && length2-(i2+1)==0)
return true;
if (length1-(i1+1)==0)
{
for (int i=i2+1;i<length2;i++)
if (!isDiacritic(word2.at(i)))
return false;
}
else
{
for (int i=i1+1;i<length1;i++)
if (!isDiacritic(word1.at(i)))
return false;
}
return true;
}
示例2: extractLilyPondSourceReference
bool Okular::extractLilyPondSourceReference( const QString &url, QString *file, int *row, int *col )
{
if ( !url.startsWith( QLatin1String( "textedit://" ) ) )
return false;
*row = 0;
*col = 0;
int lilyChar = 0;
typedef int *IntPtr;
const IntPtr int_data[] = { row, &lilyChar, col };
int int_index = sizeof( int_data ) / sizeof( int* ) - 1;
int index_last = -1;
int index = url.lastIndexOf( QLatin1Char( ':' ), index_last );
while ( index != -1 && int_index >= 0 )
{
// read the current "chunk"
const QStringRef ref = url.midRef( index + 1, index_last - index - 1 );
*int_data[ int_index ] = QString::fromRawData( ref.data(), ref.count() ).toInt();
// find the previous "chunk"
index_last = index;
index = url.lastIndexOf( QLatin1Char( ':' ), index_last - 1 );
--int_index;
}
// NOTE: 11 is the length of "textedit://"
*file = QUrl::fromPercentEncoding( url.mid( 11, index_last != -1 ? index_last - 11 : -1 ).toUtf8() );
return true;
}
示例3: paranthesesLevel
static int paranthesesLevel(const QString &line)
{
const QStringRef beforeComment = line.midRef(0, line.indexOf(QLatin1Char('#')));
const int opening = beforeComment.count(QLatin1Char('('));
const int closing = beforeComment.count(QLatin1Char(')'));
if (opening == closing)
return 0;
else if (opening > closing)
return 1;
else
return -1;
}