本文整理汇总了C++中TStringVector类的典型用法代码示例。如果您正苦于以下问题:C++ TStringVector类的具体用法?C++ TStringVector怎么用?C++ TStringVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TStringVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ListAvailableClient
void CommManager::ListAvailableClient( TStringVector& clientidList, DWORD dwDiffS /*= 60 * 5*/ )
{
__time64_t now;
_time64(&now);
m_mapSection.Enter();
{
HeartbeatMap::iterator iter = m_heartbeatMap.begin();
for (; iter != m_heartbeatMap.end(); iter++)
{
__time64_t lastHeartbeat = iter->second.time;
if (now >= lastHeartbeat && now - lastHeartbeat < dwDiffS)
{
clientidList.push_back(iter->first);
}
}
}
m_mapSection.Leave();
}
开发者ID:redblack168,项目名称:trochilus,代码行数:19,代码来源:CommManager.cpp
示例17: taskData
bool
CPing::Start( const TStringVector& remoteHosts ,
const Int32 maxPings /* = 0 */ ,
const UInt32 bytesToSend /* = 32 */ ,
const UInt32 timeout /* = 1000 */ ,
const UInt32 minimalPingDelta /* = 500 */ )
{GUCEF_TRACE;
if ( !m_isActive && ( remoteHosts.size() > 0 ) )
{
m_remoteHosts = remoteHosts;
m_maxPings = maxPings;
m_timeout = timeout;
m_bytesToSend = bytesToSend;
m_minimalPingDelta = minimalPingDelta;
CPingTaskConsumer::CPingTaskData taskData( remoteHosts, maxPings, bytesToSend, timeout, minimalPingDelta );
return CORE::CCoreGlobal::Instance()->GetTaskManager().StartTask( m_pingTaskConsumer ,
&taskData );
}
return false;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:22,代码来源:CPing.cpp
示例18: splitByChar
void splitByChar(LPCTSTR str, TStringVector& parts, TCHAR sepChar)
{
if (NULL == str) return;
tstring temp = str;
temp += sepChar;
tstring::size_type begin = 0;
tstring::size_type pos = temp.find(sepChar);
while (pos != tstring::npos)
{
tstring part;
if (pos > begin)
{
part = temp.substr(begin, pos - begin);
}
parts.push_back(part);
begin = pos + 1;
pos = temp.find(sepChar, begin);
}
}
开发者ID:5loyd,项目名称:Oh-My-Lovely-Toy,代码行数:24,代码来源:tstring.cpp
示例19: TStringVector2TStringSet
void ClientInfoManager::CheckInfoProc()
{
TStringVector clientidList;
CommManager::GetInstanceRef().ListAvailableClient(clientidList);
TStringSet clientidSet;
TStringVector2TStringSet(clientidList, clientidSet);
m_infoMapSection.Enter();
{
//从m_clientBaseInfoMap中删除已经不可用的clientinfo
ClientBaseInfoMap::iterator infoIter = m_clientBaseInfoMap.begin();
while (infoIter != m_clientBaseInfoMap.end())
{
if (clientidSet.find(infoIter->first) == clientidSet.end())
{
CLIENT_INFO clientInfo = {0};
TransferInfo(infoIter->first.c_str(), &infoIter->second, clientInfo);
if (NULL != m_fnCallback && (infoIter->second.bAdd == FALSE))
m_fnCallback(WM_DEL_CLIENT, (LPVOID)&clientInfo, m_lpParameter);
infoIter = m_clientBaseInfoMap.erase(infoIter);
}
else
{
infoIter++;
}
}
//遍历clientidList,更新m_clientBaseInfoMap
TStringVector::iterator clientidIter = clientidList.begin();
for (; clientidIter != clientidList.end(); clientidIter++)
{
const tstring& clientid = *clientidIter;
infoIter = m_clientBaseInfoMap.find(clientid.c_str());
//如果m_clientBaseInfoMap中没有该客户端的信息,则请求客户端上报
if (infoIter == m_clientBaseInfoMap.end())
{
CLIENT_BASE_INFO info;
info.bValid = FALSE;
info.bAdd = TRUE;
RequestReportInfo(clientid.c_str());
m_clientBaseInfoMap[clientid] = info;
}
else
{
if (infoIter->second.installModMsgIDMap.size() > 0)
{
HandleInstalMsg(clientid,infoIter->second);
}
if (infoIter->second.bValid && infoIter->second.bAdd)
{
CLIENT_INFO info;
TransferInfo(clientid.c_str(),&m_clientBaseInfoMap[clientid.c_str()],info);
if (NULL != m_fnCallback) m_fnCallback(WM_ADD_CLIENT, (LPVOID)&info, m_lpParameter);
infoIter->second.bAdd = FALSE;
}
}
}
}
m_infoMapSection.Leave();
}
开发者ID:redblack168,项目名称:trochilus,代码行数:65,代码来源:ClientInfoManager.cpp
示例20: GetFileNames
HRESULT CTsTeleportShellExt::GetFileNames(
IDataObject *pDataObj,
TStringVector& vFileNames)
{
HRESULT hr;
//
// init for cleanup
//
STGMEDIUM mdm;
mdm.pUnkForRelease = NULL;
mdm.hGlobal = NULL;
HDROP hdrop = NULL;
STRRET strret;
strret.pOleStr = NULL;
LPTSTR szFileName = NULL;
try
{
FORMATETC fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
hr = pDataObj->GetData(&fmt, &mdm);
LEAVE_IF_FAILED("pDataObj->GetData failed");
hdrop = (HDROP) GlobalLock(mdm.hGlobal);
if (!hdrop)
{
hr = HRESULT_FROM_WIN32(GetLastError());
}
LEAVE_IF_FAILED("GetFileNames failed");
UINT nFiles = DragQueryFile(hdrop, (UINT)-1, NULL, 0);
for(UINT nNames = 0; nNames < nFiles; nNames++)
{
UINT cchFileName = DragQueryFile(hdrop,
nNames,
NULL,
0);
ASSERT(cchFileName);
szFileName = new TCHAR[cchFileName+1];
ASSERT(szFileName); // using C++ throwing new
UINT tmp = DragQueryFile(hdrop,
nNames,
szFileName,
cchFileName+1);
DBG_UNREFERENCED_LOCAL_VARIABLE(tmp); // for fre builds
ASSERT(tmp == cchFileName);
ASSERT(szFileName[cchFileName] == '\0');
TString strFileName(szFileName);
vFileNames.push_back(strFileName);
delete [] szFileName;
szFileName = NULL;
}
}
catch (std::bad_alloc&)
{
hr = E_OUTOFMEMORY;
}
catch (std::exception&)
{
hr = E_UNEXPECTED;
}
_Function_Exit:
//
// Cleanup
//
if (hdrop)
{
GlobalUnlock(hdrop);
}
if (mdm.hGlobal)
{
ReleaseStgMedium(&mdm);
}
if (strret.pOleStr)
{
CoTaskMemFree(strret.pOleStr);
}
if (szFileName)
//.........这里部分代码省略.........
开发者ID:awakecoding,项目名称:TsTeleport,代码行数:101,代码来源:TsTeleportShellExt.cpp
注:本文中的TStringVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论