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


C++ TStringVector类代码示例

本文整理汇总了C++中TStringVector的典型用法代码示例。如果您正苦于以下问题:C++ TStringVector类的具体用法?C++ TStringVector怎么用?C++ TStringVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TStringVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CSVString

void CSVString( const TStringVector &sv, TString &string, char adelimiter )
{
  TString     word;
  int        i;
  int        n = sv.size();
  int        totallength = 0;
//  int        pos = 0;
  char       *pos;

  if( sv.size()==0 ) {
    string = "\"\"";
    return;
  }

  for( unsigned int i=0; i<n; i++ )
  {
    word = CSVString( sv[i], adelimiter );
    totallength += word.Length();
  }
  if( n>0 )
    totallength += n-1;

  string.SetLength( totallength );
  pos = string.c_str();
  for( unsigned int i=0; i<n; i++ )
  {
    word = CSVString( sv[i], adelimiter );
    strcpy( pos, word.c_str() );
    pos += word.Length();
    if( i<(n-1) ) {
      *pos = adelimiter;
      pos++;
    }
  }
}
开发者ID:Sustak,项目名称:final.utils,代码行数:35,代码来源:csv.cpp

示例2: TStringVector2TStringSet

void TStringVector2TStringSet( const TStringVector& tstringVector, TStringSet& tstringSet )
{
	TStringVector::const_iterator iter = tstringVector.begin();
	for (; iter != tstringVector.end(); iter++)
	{
		tstringSet.insert(*iter);
	}
}
开发者ID:5loyd,项目名称:Oh-My-Lovely-Toy,代码行数:8,代码来源:tstring.cpp

示例3: while

void
CMsWin32Editbox::AppendLines( TStringVector& lines )
{GUCEF_TRACE;

    TStringVector::iterator i = lines.begin();
    while ( i != lines.end() )
    {
        AppendLine( (*i) );
        ++i;
    }    
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:11,代码来源:gucefCORE_CMsWin32Editbox.cpp

示例4: VectorToSet

TStringSet
VectorToSet( const TStringVector& src )
{GUCEF_TRACE;

    TStringSet set;
    TStringVector::const_iterator i = src.begin();
    while ( i != src.end() )
    {
        set.insert( (*i) );
        ++i;
    }
    return set;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:13,代码来源:ReferenceUpdater_main.cpp

示例5: StringToS2SHash

// D: convert a string list of attribute values into a STRING2STRING 
//    representation
STRING2STRING StringToS2SHash(string sString, string sSeparator, 
                              string sEquals) {
    // extract the pairs
    TStringVector vsPairs = 
        PartitionString(sString, (char *)sSeparator.c_str());
    // form the hash
    STRING2STRING s2s;
    for(unsigned int i = 0; i < vsPairs.size(); i++) {
        string sAttr, sValue;
        SplitOnFirst(vsPairs[i], (char *)sEquals.c_str(), sAttr, sValue);        
        s2s.insert(STRING2STRING::value_type(Trim(sAttr), Trim(sValue)));
    }
    // finally, return the constructed hash
    return s2s;
}
开发者ID:quqinjiayou,项目名称:codes,代码行数:17,代码来源:Utils.cpp

示例6: DECLARE_STR_PARAM

BOOL Shell::RefershPartitions()
{
	for (int i = 0; i < 26; i++)
	{
		m_partitions[i].bValid = FALSE;
	}

	CommData request;
	request.SetMsgID(MSGID_DISKS);
	CommData commData;
	if (! AskAndWaitForReply(request, commData))
	{
		return FALSE;
	}

	DECLARE_STR_PARAM(result);
	TStringVector partitionVector;
	splitByChar(result.c_str(), partitionVector, ':');
	BOOL bFoundOne = FALSE;
	TStringVector::iterator partitionIter = partitionVector.begin();
	for (; partitionIter != partitionVector.end(); partitionIter++)
	{
		tstring& partitionStr = *partitionIter;

		TStringVector infoVector;
		splitByChar(partitionStr.c_str(), infoVector, '|');
		if (infoVector.size() != 4) continue;

		//partition(str)|drivertype(uint)|totalbytes(uint64)|freebytes(uint64):
		if (infoVector[0].size() == 0) continue;
		TCHAR partition = infoVector[0][0];
		int index = 0;
		if (partition >= 'a' && partition <= 'z') index = partition - 'a';
		else if (partition >= 'A' && partition <= 'Z') index = partition - 'A';
		else continue;

		if (1 != _stscanf_s(infoVector[1].c_str(), _T("%u"), &m_partitions[index].drivertype)) continue;
		if (1 != _stscanf_s(infoVector[2].c_str(), _T("%I64u"), &m_partitions[index].totalBytes)) continue;
		if (1 != _stscanf_s(infoVector[3].c_str(), _T("%I64u"), &m_partitions[index].freeBytes)) continue;
		m_partitions[index].curPath = ('A' + index);
		m_partitions[index].curPath += _T(":\\");

		m_partitions[index].bValid = TRUE;
		bFoundOne = TRUE;
	}

	return bFoundOne;
}
开发者ID:a3587556,项目名称:trochilus,代码行数:48,代码来源:Shell.cpp

示例7: Start

bool
CPing::Start( const CORE::CString& remoteHost           ,
              const Int32 maxPings /* = 0 */            ,
              const UInt32 bytesToSend /* = 32 */       ,
              const UInt32 timeout /* = 1000 */         ,
              const UInt32 minimalPingDelta /* = 500 */ )
{GUCEF_TRACE;

    TStringVector hostList;
    hostList.push_back( remoteHost );
    return Start( hostList         ,
                  maxPings         ,
                  bytesToSend      ,
                  timeout          ,
                  minimalPingDelta );
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:16,代码来源:CPing.cpp

示例8: BuildSourceFileList

void
BuildSourceFileList( const CORE::CString& srcDir                 ,
                     const TStringVector& listOfRootSubDirsToUse ,
                     TMatchEntryVector& matches                  ,
                     const TStringSet* fileTypes                 ,
                     const TStringSet* dirsToIgnore              )
{GUCEF_TRACE;

    // get a list of all the files
    TFileEntryVector files;
    BuildFileList( srcDir, files, fileTypes, dirsToIgnore );
    
    TStringVector::const_iterator i = listOfRootSubDirsToUse.begin();
    while ( i != listOfRootSubDirsToUse.end() )
    {
        CORE::CString subRoot = srcDir;
        CORE::AppendToPath( subRoot, (*i) );

        // get a list of all the files
        TFileEntryVector subFiles;
        BuildFileList( subRoot, subFiles, fileTypes, dirsToIgnore );
        
        // Fix relative paths to include rootdir
        TFileEntryVector::iterator n = subFiles.begin();
        while ( n != subFiles.end() )
        {
            // Put root dir prefix in place again to fix relative path
            CORE::CString actualRelPath = (*i);
            CORE::AppendToPath( actualRelPath, (*n).filedir );
            (*n).filedir = actualRelPath;
            
            ++n;
        }
        
        ++i;
    }
    
    // add entry for each file
    TFileEntryVector::iterator m = files.begin();
    while ( m != files.end() ) 
    {
        TMatchEntry matchEntry;
        matchEntry.source = (*m);        
        matches.push_back( matchEntry );        
        ++m;
    }
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:47,代码来源:ReferenceUpdater_main.cpp

示例9: splitByChar

BOOL CommandManager::Execute( LPCTSTR cmdline, tstring& replyText )
{
    //分割并整理命令行的各个部分
    TStringVector parts;
    splitByChar(cmdline, parts, ' ');

    TStringVector::iterator iter = parts.begin();
    while (iter != parts.end())
    {
        tstring& part = *iter;
        trim(part);
        if (part.size() == 0)
        {
            iter = parts.erase(iter);
        }
        else
        {
            iter++;
        }
    }

    //检查是否有可用的部分
    if (parts.size() == 0)
    {
        replyText = _T("invalid command.");
        return FALSE;
    }

    //查找可用的命令
    tstring& cmdname = parts[0];
    makeLower(cmdname);

    CommandMap::iterator cmdIter = m_cmdMap.find(cmdname);
    if (cmdIter == m_cmdMap.end())
    {
        replyText = _T("no such command.");
        return FALSE;
    }

    //执行命令
    ICmd* pCmd = cmdIter->second;
    BOOL bExecuteOK = pCmd->Execute(parts, replyText, m_env);

    return bExecuteOK;
}
开发者ID:benzeng,项目名称:trochilus,代码行数:45,代码来源:CommandManager.cpp

示例10: ASSERT

void CAppWindow::TruncateLastReported()
{
	ASSERT(m_lpView != NULL);

	const TWaveMap & vReported = m_lpReportedView->GetWaves();
	const TWaveMap & vCurrent = m_lpView->GetWaves()->GetWaves();
	TStringVector vRemove;

	for (TWaveMapConstIter iter = vReported.begin(); iter != vReported.end(); iter++)
	{
		if (vCurrent.find(iter->first) == vCurrent.end())
		{
			vRemove.push_back(iter->first);
		}
	}

	m_lpReportedView->RemoveWaves(vRemove);
}
开发者ID:pvginkel,项目名称:wave-notify,代码行数:18,代码来源:CAppWindow.cpp

示例11: splitByChar

void Shell::MakeAbsolutePath( LPCTSTR filepath, tstring& absoPath )
{
	TStringVector parts;
	splitByChar(filepath, parts, '\\');

	std::list<tstring> dirStack;
	TStringVector::iterator iter = parts.begin();
	for (; iter != parts.end(); iter++)
	{
		tstring& part = *iter;
		trim(part, ' ');
		if (part.size() == 0)
		{
			if (dirStack.size() > 0)
			{
				tstring partition = dirStack.front();
				dirStack.clear();
				dirStack.push_back(partition);
			}
		}
		else if (part == _T(".")) 
		{
			continue;
		}
		else if (part == _T(".."))
		{
			if (dirStack.size() > 0) dirStack.pop_back();
		}
		else
		{
			dirStack.push_back(part);
		}
	}

	tostringstream toss;
	std::list<tstring>::iterator stackIter = dirStack.begin();
	for (; stackIter != dirStack.end(); stackIter++)
	{
		toss << stackIter->c_str() << '\\';
	}

	absoPath = toss.str();
	trim(absoPath, '\\');
}
开发者ID:a3587556,项目名称:trochilus,代码行数:44,代码来源:Shell.cpp

示例12: FindChildrenOfType

CDataNode::TStringVector
CDataNode::GetChildrenValuesByName( const CString& name ) const
{
    TStringVector results;
    
    TConstDataNodeSet childNodes = FindChildrenOfType( name, false );
    TConstDataNodeSet::iterator i = childNodes.begin();
    while ( i != childNodes.end() )
    {
        const CString& childValue = (*i)->GetValue();
        if ( !childValue.IsNULLOrEmpty() )
        {
            results.push_back( childValue );
        }
        ++i;
    }

    return results;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:19,代码来源:CDataNode.cpp

示例13: TeleportFiles

HRESULT CTsTeleportShellExt::TeleportFiles(TStringVector& vFileNames)
{
    HRESULT hr = S_OK;

    TStringVector::iterator iter = vFileNames.begin();

    //
    // Open virtual channel
    //

    if (!_hDVC)
    {
        hr = GetVirtualChannelHandle(&_hDVC);
    }
    LEAVE_IF_FAILED("GetVirtualChannelHandle failed");

    for (; iter != vFileNames.end(); iter++)
    {
        hr = TeleportFile((LPTSTR) (*iter).c_str());
        LEAVE_IF_FAILED("TeleportFile (%s) failed", (*iter).c_str());
    }

_Function_Exit:

    if (_hDVC)
    {
        //
        // Close virtual channel
        //

        CloseHandle(_hDVC);
        _hDVC = NULL;
    }

    return hr;
}
开发者ID:awakecoding,项目名称:TsTeleport,代码行数:36,代码来源:TsTeleportShellExt.cpp

示例14: ListItem

bool
CComboboxImp::SetListItems( const TStringVector& items )
{GUCE_TRACE;

    if ( NULL != m_combobox )
    {
        m_combobox->resetList();
        for ( UInt32 i=0; i<items.size(); ++i )
        {
            m_combobox->addItem( new ListItem( items[ i ].C_String() ) );
        }
        return true;
    }
    return false;
}
开发者ID:LiberatorUSA,项目名称:GUCE,代码行数:15,代码来源:guceCEGUIOgre_CComboboxImp.cpp

示例15:

bool
CComboboxImp::GetListItems( TStringVector& items ) const
{GUCE_TRACE;

    if ( NULL != m_combobox )
    {
        CEGUI::ListboxItem* item = NULL;
        size_t itemCount = m_combobox->getItemCount();
        for ( size_t i=0; i<itemCount; ++i )
        {
            item = m_combobox->getListboxItemFromIndex( i );
            items.push_back( item->getText().c_str() );
        }
        return true;
    }
    return false;
}
开发者ID:LiberatorUSA,项目名称:GUCE,代码行数:17,代码来源:guceCEGUIOgre_CComboboxImp.cpp


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