本文整理汇总了C++中TQStringList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ TQStringList::count方法的具体用法?C++ TQStringList::count怎么用?C++ TQStringList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TQStringList
的用法示例。
在下文中一共展示了TQStringList::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextMatch
TQString TDECompletion::nextMatch()
{
TQString completion;
myLastMatch = myCurrentMatch;
if ( d->matches.isEmpty() ) {
findAllCompletions( myLastString, &d->matches, myHasMultipleMatches );
completion = d->matches.first();
myCurrentMatch = completion;
myRotationIndex = 0;
postProcessMatch( &completion );
emit match( completion );
return completion;
}
TQStringList matches = d->matches.list();
myLastMatch = matches[ myRotationIndex++ ];
if ( myRotationIndex == matches.count() -1 )
doBeep( Rotation ); // indicate last matching item -> rotating
else if ( myRotationIndex == matches.count() )
myRotationIndex = 0;
completion = matches[ myRotationIndex ];
myCurrentMatch = completion;
postProcessMatch( &completion );
emit match( completion );
return completion;
}
示例2: addToList
void KateSearch::addToList( TQStringList& list, const TQString& s )
{
if( list.count() > 0 ) {
TQStringList::Iterator it = list.find( s );
if( *it != 0L )
list.remove( it );
if( list.count() >= 16 )
list.remove( list.fromLast() );
}
list.prepend( s );
}
示例3: word
TQString KStringHandler::word( const TQString &text , const char *range )
{
// Format in: START:END
// Note index starts a 0 (zero)
//
// 0: first word to end
// 1:3 second to fourth words
TQStringList list = TQStringList::split( " ", text , true );
TQString tmp = "";
TQString r = range;
if ( text.isEmpty() )
return tmp;
uint pos = 0, cnt = list.count();
parsePythonRange( range, pos, cnt );
//
// Extract words
//
int wordsToExtract = cnt-pos+1;
TQStringList::Iterator it = list.at( pos);
while ( (it != list.end()) && (wordsToExtract-- > 0))
{
tmp += *it;
tmp += " ";
it++;
}
return tmp.stripWhiteSpace();
}
示例4: remrange
TQString KStringHandler::remrange( const TQString &text , const char *range )
{
// Format in: START:END
// Note index starts a 0 (zero)
//
// 0: first word to end
// 1:3 second to fourth words
TQStringList list = TQStringList::split( " ", text , true );
TQString tmp = "";
TQString r = range;
if ( text.isEmpty() )
return tmp;
uint pos = 0, cnt = list.count();
parsePythonRange( range, pos, cnt );
//
// Remove that range of words
//
int wordsToDelete = cnt-pos+1;
TQStringList::Iterator it = list.at( pos);
while ( (it != list.end()) && (wordsToDelete-- > 0))
it = list.remove( it );
return list.join( " " );
}
示例5: while
TQStringList
KStringHandler::perlSplit(const TQRegExp & sep, const TQString & s, uint max)
{
bool ignoreMax = 0 == max;
TQStringList l;
int searchStart = 0;
int tokenStart = sep.search(s, searchStart);
int len = sep.matchedLength();
while (-1 != tokenStart && (ignoreMax || l.count() < max - 1))
{
if (!s.mid(searchStart, tokenStart - searchStart).isEmpty())
l << s.mid(searchStart, tokenStart - searchStart);
searchStart = tokenStart + len;
tokenStart = sep.search(s, searchStart);
len = sep.matchedLength();
}
if (!s.mid(searchStart, s.length() - searchStart).isEmpty())
l << s.mid(searchStart, s.length() - searchStart);
return l;
}
示例6: addCpus
uint CpuConfig::addCpus()
{
#ifdef Q_OS_LINUX
TQStringList output;
TQString parser;
TQFile file("/proc/stat");
if (!file.open(IO_ReadOnly))
return 0;
// Parse the proc file
TQTextStream procStream(&file);
while (!procStream.atEnd()) {
parser = procStream.readLine();
if (TQRegExp("cpu").search(parser, 0) != -1
&& TQRegExp("cpu0").search(parser, 0) == -1) {
output.append(parser);
}
}
return output.count();
#endif
#ifdef Q_OS_BSD4
int mib[] = { CTL_HW, HW_NCPU }; // hw.ncpu
uint cpu;
size_t cpuLen = sizeof(cpu);
if (sysctl(mib, 2, &cpu, &cpuLen, NULL, 0) < 0)
return 0;
return cpu;
#endif
}
示例7: slotSelectImagesClicked
void CreateSmileyWindow::slotSelectImagesClicked( )
{
TQString startDir = TQDir::homeDirPath();
TQStringList fileNames = KFileDialog::getOpenFileNames(startDir,
"*.png *.bmp *.jpg *.jpeg *.gif |" + i18n(" all images (*.png *.bmp *.jpg *.jpeg *.gif)"), this,
i18n("select image file(s)"));
if(fileNames.count() == 1){
m_FileName = fileNames[0];
TQString file = m_FileName.right( m_FileName.length() - m_FileName.findRev("/") - 1);
lblSelect->setText(file);
leShortcut->setEnabled( true);
leShortcut->setText(file.left(6));
leTip->setEnabled( true );
leTip->setText(file.left( file.findRev(".") ) );
}else{
m_MultiFiles = true;
lblSelect->setText(i18n("Multi-Files Selected."));
m_FileNames = fileNames;
leShortcut->setText("");
leTip->setText("");
leShortcut->setEnabled( false);
leTip->setEnabled( false);
}
}
示例8: setFindHistory
void KFindDialog::setFindHistory(const TQStringList &strings)
{
if (strings.count() > 0)
{
m_find->setHistoryItems(strings, true);
m_find->lineEdit()->setText( strings.first() );
m_find->lineEdit()->selectAll();
}
else
m_find->clearHistory();
}
示例9: reverse
TQStringList KStringHandler::reverse( const TQStringList &list )
{
TQStringList tmp;
if ( list.count() == 0 )
return tmp;
for ( TQStringList::ConstIterator it= list.begin();
it != list.end();
it++)
tmp.prepend( *it );
return tmp;
}
示例10: installThemes
bool IconThemesConfig::installThemes(const TQStringList &themes, const TQString &archiveName)
{
bool everythingOk = true;
TQString localThemesDir(locateLocal("icon", "./"));
KProgressDialog progressDiag(this, "themeinstallprogress",
i18n("Installing icon themes"),
TQString::null,
true);
progressDiag.setAutoClose(true);
progressDiag.progressBar()->setTotalSteps(themes.count());
progressDiag.show();
KTar archive(archiveName);
archive.open(IO_ReadOnly);
kapp->processEvents();
const KArchiveDirectory* rootDir = archive.directory();
KArchiveDirectory* currentTheme;
for (TQStringList::ConstIterator it = themes.begin();
it != themes.end();
++it) {
progressDiag.setLabel(
i18n("<qt>Installing <strong>%1</strong> theme</qt>")
.arg(*it));
kapp->processEvents();
if (progressDiag.wasCancelled())
break;
currentTheme = dynamic_cast<KArchiveDirectory*>(
const_cast<KArchiveEntry*>(
rootDir->entry(*it)));
if (currentTheme == NULL) {
// we tell back that something went wrong, but try to install as much
// as possible
everythingOk = false;
continue;
}
currentTheme->copyTo(localThemesDir + *it);
progressDiag.progressBar()->advance(1);
}
archive.close();
return everythingOk;
}
示例11: remword
TQString KStringHandler::remword( const TQString &text , uint pos )
{
TQString tmp = "";
if ( text.isEmpty() )
return tmp;
// Split words and add into list
TQStringList list = TQStringList::split( " ", text, true );
if ( pos < list.count() )
list.remove( list.at( pos ) );
// Rejoin
return list.join( " " );
}
示例12: initialize
void KMWLocal::initialize()
{
TQStringList list = KMFactory::self()->manager()->detectLocalPrinters();
if (list.isEmpty() || (list.count() % 4) != 0)
{
KMessageBox::error(this, i18n("Unable to detect local ports."));
return;
}
TQListViewItem *last[4] = {0, 0, 0, 0};
for (TQStringList::Iterator it=list.begin(); it!=list.end(); ++it)
{
TQString cl = *it;
++it;
TQString uri = *it;
int p = uri.find( ':' );
TQString desc = *(++it), prot = ( p != -1 ? uri.left( p ) : TQString::null );
TQString printer = *(++it);
int index(-1);
if (desc.isEmpty())
desc = uri;
if (prot == "parallel" || prot == "file")
index = 0;
else if (prot == "serial")
index = 1;
else if (prot == "usb")
index = 2;
else if (cl == "direct")
index = 3;
else
continue;
last[index] = new TQListViewItem(m_parents[index], last[index], desc, uri);
last[index]->setPixmap(0, SmallIcon("blockdevice"));
m_parents[index]->setOpen(true);
m_uris << uri;
if (!printer.isEmpty())
{
TQListViewItem *pItem = new TQListViewItem(last[index], printer);
last[index]->setOpen(true);
pItem->setPixmap(0, SmallIcon("tdeprint_printer"));
}
}
m_initialized = true;
}
示例13: startCondition
static bool startCondition(const TQString &condition)
{
if (condition.isEmpty())
return true;
TQStringList list = TQStringList::split(':', condition, true);
if (list.count() < 4)
return true;
if (list[0].isEmpty() || list[2].isEmpty())
return true;
TDEConfig config(list[0], true, false);
if (!list[1].isEmpty())
config.setGroup(list[1]);
bool defaultValue = (list[3].lower() == "true");
return config.readBoolEntry(list[2], defaultValue);
}
示例14: insword
//
// Insertion and removal routines
//
TQString KStringHandler::insword( const TQString &text , const TQString &word , uint pos )
{
if ( text.isEmpty() )
return word;
if ( word.isEmpty() )
return text;
// Split words and add into list
TQStringList list = TQStringList::split( " ", text, true );
if ( pos >= list.count() )
list.append( word );
else
list.insert( list.at(pos) , word );
// Rejoin
return list.join( " " );
}
示例15: windowWmCommand
TQStringList KSMServer::windowWmCommand(WId w)
{
TQStringList ret = getQStringListProperty(w, XA_WM_COMMAND);
// hacks here
if( ret.count() == 1 ) {
TQString command = ret.first();
// Mozilla is launched using wrapper scripts, so it's launched using "mozilla",
// but the actual binary is "mozilla-bin" or "<path>/mozilla-bin", and that's what
// will be also in WM_COMMAND - using this "mozilla-bin" doesn't work at all though
if( command.endsWith( "mozilla-bin" ))
return TQStringList() << "mozilla";
if( command.endsWith( "firefox-bin" ))
return TQStringList() << "firefox";
if( command.endsWith( "thunderbird-bin" ))
return TQStringList() << "thunderbird";
if( command.endsWith( "sunbird-bin" ))
return TQStringList() << "sunbird";
}
return ret;
}