当前位置: 首页>>代码示例>>C++>>正文


C++ TQStringList::count方法代码示例

本文整理汇总了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;
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:30,代码来源:kcompletion.cpp

示例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 );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:11,代码来源:katesearch.cpp

示例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();
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:32,代码来源:kstringhandler.cpp

示例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( " " );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:28,代码来源:kstringhandler.cpp

示例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;
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:26,代码来源:kstringhandler.cpp

示例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
}
开发者ID:Fat-Zer,项目名称:tdeutils,代码行数:32,代码来源:ksimcpu.cpp

示例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);
	}
}
开发者ID:MagicGroup,项目名称:eva,代码行数:27,代码来源:createsmileywindow.cpp

示例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();
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:11,代码来源:kfinddialog.cpp

示例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;
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:14,代码来源:kstringhandler.cpp

示例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;
}
开发者ID:Fat-Zer,项目名称:tdebase,代码行数:48,代码来源:iconthemes.cpp

示例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( " " );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:16,代码来源:kstringhandler.cpp

示例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;
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:44,代码来源:kmwlocal.cpp

示例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);
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:19,代码来源:autostart.cpp

示例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( " " );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:22,代码来源:kstringhandler.cpp

示例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;
}
开发者ID:Fat-Zer,项目名称:tdebase,代码行数:20,代码来源:legacy.cpp


注:本文中的TQStringList::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。