本文整理汇总了C++中STRINGLIST::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ STRINGLIST::clear方法的具体用法?C++ STRINGLIST::clear怎么用?C++ STRINGLIST::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STRINGLIST
的用法示例。
在下文中一共展示了STRINGLIST::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenThread
void IGFManager :: OpenThread(int threadID, int startPost, int requestedCount, MULTISTRING &output)
{
IGFThread *thread = GetPagedThreadPtr(threadID);
if(thread == NULL)
return;
startPost = Util::ClipInt(startPost, 0, thread->mPostList.size() - 1);
STRINGLIST row;
//We retrieve the time offset since the first session since the client uses
//4 byte integers which theoretically may not be large enough to hold the time data.
unsigned long timeOffset = g_PlatformTime.getAbsoluteMinutes();
//Prepare the header
row.push_back(ConvertInteger(threadID)); //[0]
row.push_back(thread->mTitle); //[1]
row.push_back(ConvertInteger(startPost)); //[2]
row.push_back(ConvertInteger(thread->mPostList.size())); //[3]
row.push_back(ConvertInteger(timeOffset - thread->mLastUpdateTime)); //[4]
output.push_back(row);
row.clear();
//Append the post data.
int count = 0;
for(size_t i = startPost; i < thread->mPostList.size(); i++)
{
IGFPost *post = GetPagedPostPtr(thread->mPostList[i]);
if(post == NULL)
{
g_Logs.data->error("OpenThread: unable to find post: %v", thread->mPostList[i]);
continue;
}
row.push_back(ConvertInteger(post->mID)); //[0]
row.push_back(post->mCreatorName.c_str()); //[1]
row.push_back(post->mCreationTime.c_str()); //[2]
row.push_back(ConvertInteger(timeOffset - post->mPostedTime)); //[3]
row.push_back(post->mBodyText.c_str()); //[4]
row.push_back(ConvertInteger(post->mEditCount)); //[5]
row.push_back(ConvertInteger(timeOffset - post->mLastUpdateTime)); //[6]
output.push_back(row);
row.clear();
if(++count >= requestedCount)
break;
}
}
示例2: EnumCategoryList
void IGFManager :: EnumCategoryList(int parentID, MULTISTRING &output)
{
STRINGLIST entry;
CATEGORYPAGE::iterator it;
IGFCategoryPage::CATEGORYENTRY::iterator eit;
for(it = mCategoryPages.begin(); it != mCategoryPages.end(); ++it)
{
for(eit = it->second.mEntries.begin(); eit != it->second.mEntries.end(); ++eit)
{
if(eit->second.mParentCategory == parentID)
{
entry.push_back(ConvertInteger(TYPE_CATEGORY));
entry.push_back(ConvertInteger(eit->second.mID));
entry.push_back(ConvertInteger(eit->second.mLocked));
entry.push_back(ConvertInteger(0)); //Stickied. Categories don't have this.
entry.push_back(eit->second.mTitle);
entry.push_back(ConvertInteger(eit->second.mThreadList.size()));
entry.push_back(ConvertInteger(GetTimeOffset(eit->second.mLastUpdateTime)));
output.push_back(entry);
entry.clear();
}
}
}
}
示例3: EnumThreadList
void IGFManager :: EnumThreadList(int parentID, MULTISTRING &output)
{
IGFCategory* category = GetPagedCategoryPtr(parentID);
if(category == NULL)
return;
//Pregenerate a list of threads
std::vector<IGFThread*> results;
for(size_t i = 0; i < category->mThreadList.size(); i++)
{
IGFThread* thread = GetPagedThreadPtr(category->mThreadList[i]);
if(thread != NULL)
results.push_back(thread);
}
if(category->mFlags.hasFlag(IGFFlags::FLAG_SORTALPHABETICAL))
std::sort(results.begin(), results.end(), ThreadSortAlphabetical);
STRINGLIST entry;
for(size_t i = 0; i < results.size(); i++)
{
IGFThread* thread = results[i];
entry.push_back(ConvertInteger(TYPE_THREAD));
entry.push_back(ConvertInteger(thread->mID));
entry.push_back(ConvertInteger(thread->mLocked));
entry.push_back(ConvertInteger(thread->mStickied));
entry.push_back(thread->mTitle);
entry.push_back(ConvertInteger(thread->mPostList.size()));
entry.push_back(ConvertInteger(GetTimeOffset(thread->mLastUpdateTime)));
output.push_back(entry);
entry.clear();
}
}
示例4: TokenizeByWhitespace
// Tokenize a string using whitespace as separators, but including string quotations.
void TokenizeByWhitespace(const std::string &input, STRINGLIST &output)
{
std::string str = input;
output.clear();
size_t len = str.size();
int first = -1;
int last = -1;
bool quote = false;
bool terminate = false;
for(size_t i = 0; i < len; i++)
{
switch(input[i])
{
case '"':
terminate = true; //Treat opening quote as a block start
quote = !quote;
break;
case ' ':
case '\t':
case '\n':
case '\r':
if(quote == false)
terminate = true;
break;
default:
if(first == -1)
first = i;
last = i;
}
if(terminate == true)
{
if(first >= 0 && last >= 0)
{
std::string t = str.substr(first, last - first + 1);
output.push_back(str.substr(first, last - first + 1));
first = -1;
last = -1;
}
terminate = false;
}
}
if(first != -1 && first < (int)len)
output.push_back(str.substr(first, len - first + 1));
}