本文整理汇总了C++中Hashtable::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Hashtable::clear方法的具体用法?C++ Hashtable::clear怎么用?C++ Hashtable::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hashtable
的用法示例。
在下文中一共展示了Hashtable::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pop
void Tabid::pop() {
if (symbols->size() == 0) return;
Hashtable *bucket = (*symbols)[0];
Hashtable::iterator iter = bucket->begin(),
end = bucket->end();
while (iter != end)
delete iter->second;
bucket->clear();
symbols->pop_back();
delete bucket;
}
示例2: pop
void Tabid::pop() {
if (symbols->size() == 0) return;
Hashtable *bucket = symbols->back();
Hashtable::iterator iter = bucket->begin(),
end = bucket->end();
while (iter != end) {
delete &iter->first;
delete iter->second;
iter++;
}
bucket->clear();
symbols->pop_back();
delete bucket;
}
示例3: readHeaders
boolean CNetRequestImpl::readHeaders(Hashtable<String,String>& oHeaders)
{
oHeaders.clear();
CAtlStringW strHeaders;
DWORD dwLen = 0;
DWORD nIndex = 0;
if( !HttpQueryInfo( hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, null, &dwLen, &nIndex) )
{
DWORD dwErr = ::GetLastError();
if ( dwErr != ERROR_INSUFFICIENT_BUFFER )
{
pszErrFunction = L"HttpQueryInfo";
return false;
}
}
if( !HttpQueryInfo( hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, strHeaders.GetBuffer(dwLen), &dwLen, &nIndex) )
{
pszErrFunction = L"HttpQueryInfo";
return false;
}
strHeaders.ReleaseBuffer();
int nStart = 0;
for(int nEnd = strHeaders.Find(L"\r\n", nStart); nEnd > 0; nStart = nEnd+2, nEnd = strHeaders.Find(L"\r\n", nStart) )
{
CAtlStringW strHeader = strHeaders.Mid(nStart, nEnd-nStart);
int nSep = strHeader.Find(':');
if (nSep < 0 )
continue;
CAtlStringW strName = strHeader.Mid(0, nSep);
strName.Trim();
strName.MakeLower();
CAtlStringW strValue = strHeader.Mid(nSep+1);
strValue.Trim();
oHeaders.put(common::convertToStringA(strName.GetString()),common::convertToStringA(strValue.GetString()));
}
return true;
}