本文整理汇总了C++中CStringList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::push_back方法的具体用法?C++ CStringList::push_back怎么用?C++ CStringList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParserExpression
int MonitorThread::ParserExpression(CString strExpression, CStringList &lstOperator, CStringList &lstID)
{
if(strExpression.IsEmpty())
return -1;
CString strTemp="";
int pos=0;
int nb=0;
int n=0;
if((pos=strExpression.Find(SEPARATOR,0))<0)
{
// lstID.AddTail(strExpression);
lstID.push_back(strExpression.getText());
return 0;
}
for(nb=0;pos>-1;nb++)
{
strTemp=strExpression.Mid(nb,pos-nb);
// lstID.AddTail(strTemp);
lstID.push_back(strTemp.getText());
pos++;
nb=strExpression.Find(SEPARATOR,pos);
if(nb<0)
return -2;
strTemp=strExpression.Mid(pos,nb-pos);
// lstOperator.AddTail(strTemp);
lstOperator.push_back(strTemp.getText());
pos=strExpression.Find(SEPARATOR,nb+1);
n++;
}
// lstID.AddTail(strExpression.Right(strExpression.GetLength()-strExpression.ReverseFind(SEPARATOR)-1));
lstID.push_back(strExpression.Right(strExpression.GetLength()-strExpression.ReverseFind(SEPARATOR)-1).getText());
return n;
}
示例2: while
static
void
tokenize(CStringList& tokens, const CString& src)
{
// find first non-whitespace
CString::size_type x = src.find_first_not_of(" \t\r\n");
if (x == CString::npos) {
return;
}
// find next whitespace
do {
CString::size_type y = src.find_first_of(" \t\r\n", x);
if (y == CString::npos) {
y = src.size();
}
tokens.push_back(src.substr(x, y - x));
x = src.find_first_not_of(" \t\r\n", y);
} while (x != CString::npos);
}
示例3: BuildFileList
// Pass in relative path, do search on path including mod directory, return files relative to mod directory
bool BuildFileList(const string& inBaseDirectoryName, const string& inDirectoryName, const string& inFileExtension, CStringList& outList)
{
#ifdef WIN32
const string kDelimiter("\\");
#else
const string kDelimiter("/");
#endif
bool theSuccess = false;
string theBaseDirectoryName = inBaseDirectoryName;
string theDirectoryName = inDirectoryName;
#ifdef WIN32
// Replace all forward slashes with \\'s if needed
std::replace(theBaseDirectoryName.begin(), theBaseDirectoryName.end(), '/', '\\');
std::replace(theDirectoryName.begin(), theDirectoryName.end(), '/', '\\');
#endif
string theFullDirName = theBaseDirectoryName + theDirectoryName;
size_t theEndOffset = theDirectoryName.find_last_of(kDelimiter);
string theBaseDirName = theDirectoryName.substr(0, theEndOffset);
theFullDirName += inFileExtension;
#ifdef WIN32
WIN32_FIND_DATA theFindData;
HANDLE theFileHandle;
theFileHandle = FindFirstFile(theFullDirName.c_str(), &theFindData);
if (theFileHandle != INVALID_HANDLE_VALUE)
{
do
{
string theFoundFilename = string(theFindData.cFileName);
#else
string theFoundFilename;
FIND_DATA theFindData;
const char* theFullDirNameCStr = theFullDirName.c_str();
int theRC = FindFirstFile(theFullDirNameCStr, &theFindData);
if(theRC != -1)
{
do
{
string theFoundFilename = string(theFindData.cFileName);
#endif
CString theCString;
string theFullFileName = theBaseDirName + string("/") + theFoundFilename;
// Precache requires / in the filename
std::replace(theFullFileName.begin(), theFullFileName.end(), '\\', '/');
theCString = theFullFileName;
outList.push_back(theCString);
theSuccess = true;
#ifdef WIN32
}
while(FindNextFile(theFileHandle, &theFindData));
}
#else
}
while(FindNextFile(0, &theFindData));
}
#endif
//DIR theDirp = opendir(theDirName.c_str());
// while(theDirp)
// {
// int theErrno = 0;
// if ((dp = readdir(theDirp)) != NULL) {
// if (strcmp(dp->d_name, name) == 0) {
// closedir(theDirp);
// return FOUND;
// }
// } else {
// if (theErrno == 0) {
// closedir(theDirp);
// return NOT_FOUND;
// }
// closedir(theDirp);
// return READ_ERROR;
// }
// }
// return OPEN_ERROR;
return theSuccess;
}