本文整理汇总了C++中ObjList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjList::clear方法的具体用法?C++ ObjList::clear怎么用?C++ ObjList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjList
的用法示例。
在下文中一共展示了ObjList::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copy
// Copy a SrvRecord list into another one
void SrvRecord::copy(ObjList& dest, const ObjList& src)
{
dest.clear();
for (ObjList* o = src.skipNull(); o; o = o->skipNext()) {
SrvRecord* rec = static_cast<SrvRecord*>(o->get());
dest.append(new SrvRecord(rec->order(),rec->pref(),rec->address(),rec->port()));
}
}
示例2: parse
//.........这里部分代码省略.........
unsigned int count = 0;
const char* line = 0;
// Skip empty lines before a message line and skip trailing blanks on the message line
while (crt < len) {
line = getLine(buffer,len,crt,count);
if (!line) {
error = "Invalid end-of-line";
break;
}
// Exit loop if the line is not empty
if (count)
break;
}
if (!count || error)
break;
// *** Decode the message line
MGCPMessage* msg = decodeMessage(line,count,trans,error,engine);
if (!msg)
break;
dest.append(msg);
#ifdef PARSER_DEBUG
String m((const char*)line,count);
Debug(engine,DebugAll,"Decoded message: %s",m.c_str());
#endif
// *** Decode parameters
if (decodeParams(buffer,len,crt,msg,error,engine))
continue;
if (error) {
if (msg->isCommand())
trans = msg->transactionId();
break;
}
if (crt >= len)
break;
// *** Decode SDP
// Decode SDPs until the end of buffer or
// a line containing a dot (message separator in a piggybacked block)
// SDPs are separated by an empty line
int empty = 0;
while (empty < 2) {
// Skip until an empty line, a line containing a dot or end of buffer
unsigned int start = crt;
unsigned int sdpLen = 0;
while (true) {
line = getLine(buffer,len,crt,count);
if (!line) {
error = "Invalid end-of-line";
break;
}
if (!count || (count == 1 && (*line == '.' || !*line))) {
if (!count)
empty++;
else
empty = 3;
break;
}
empty = 0;
sdpLen = crt - start;
}
if (error)
break;
if (sdpLen)
msg->sdp.append(new MimeSdpBody(sdpType,(const char*)buffer+start,sdpLen));
}
// Found 2 empty lines: skip until end of buffer or line containing '.' or non empty line
if (empty == 2) {
unsigned int start = crt;
while (true) {
line = getLine(buffer,len,crt,count);
if (!line) {
error = "Invalid end-of-line";
break;
}
if (!count) {
if (crt == len)
break;
continue;
}
// Fallback with current index if found non empty line which doesn't start with '.'
if (*line && *line != '.')
crt = start;
break;
}
}
}
if (!error)
return true;
dest.clear();
if (trans && trans <= 999999999)
dest.append(new MGCPMessage(engine,0,errorCode,trans,0,0));
Debug(engine,DebugNote,"Parser error: %s",error.c_str());
return false;
}