本文整理汇总了C++中qstringlist::iterator::lastIndexOf方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::lastIndexOf方法的具体用法?C++ iterator::lastIndexOf怎么用?C++ iterator::lastIndexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::iterator
的用法示例。
在下文中一共展示了iterator::lastIndexOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
//.........这里部分代码省略.........
if ( text.startsWith( '\n' ) )
list.prepend( QString() );
if(list.isEmpty())
list.append( QString() );
if( list.count() > 1 )
list.prepend( QString() );
stream << keyword << ' ';
QStringList::const_iterator it;
for( it = list.constBegin(); it != list.constEnd(); ++it )
stream << '\"' << (*it) << "\"\n";
return;
}
#endif
if ( m_wrapWidth == 0 ) // Unknown special wrapping, so assume "no wrap" instead
{
// No wrapping (like Gettext's --no.wrap or -w0 )
// we need to remove the \n characters, as they are extra characters
QString realText( text );
realText.remove( '\n' );
stream << keyword << " \"" << realText << "\"\n";
return;
}
else if ( m_wrapWidth < 0 )
{
// No change in wrapping
QStringList list = text.split( '\n');
if (list.count()>1 || startedWithEmptyLine /* || keyword.length()+3+text.length()>=80*/)
list.prepend(QString());
stream << keyword << " ";
QStringList::const_iterator it;
for( it = list.constBegin(); it != list.constEnd(); ++it )
stream << "\"" << (*it) << "\"\n";
return;
}
// lazy wrapping
QStringList list = text.split( '\n', QString::SkipEmptyParts );
if ( text.startsWith( '\n' ) )
list.prepend( QString() );
if(list.isEmpty())
list.append( QString() );
static QRegExp breakStopReForHtml("[ >.%]", Qt::CaseSensitive, QRegExp::Wildcard);
QRegExp breakStopRe=containsHtml?breakStopReForHtml:QRegExp("[ .%]", Qt::CaseSensitive, QRegExp::Wildcard);
int max=m_wrapWidth-2;
bool prependedEmptyLine=false;
QStringList::iterator itm;
for( itm = list.begin(); itm != list.end(); ++itm )
{
if (list.count()==1 && keyword.length()+1+itm->length()>=max)
{
prependedEmptyLine=true;
itm=list.insert(itm,QString());
}
if (itm->length()>max)
{
int pos = itm->lastIndexOf(breakStopRe,max-1);
if (pos>0)
{
int pos2 = itm->indexOf('<',pos);
if (pos2>0&&pos2<max-1)
pos=itm->indexOf('<',pos);
++pos;
}
else
pos=max;
//itm=list.insert(itm,itm->left(pos));
QString t=*itm;
itm=list.insert(itm,t);
itm++;
if (itm != list.end())
{
(*itm)=itm->remove(0,pos);
itm--;
if (itm != list.end())
itm->truncate(pos);
}
}
}
if( !prependedEmptyLine && list.count() > 1 )
list.prepend( QString() );
stream << keyword << " ";
QStringList::const_iterator it;
for( it = list.constBegin(); it != list.constEnd(); ++it )
stream << "\"" << (*it) << "\"\n";
}