本文整理汇总了C++中LString::append方法的典型用法代码示例。如果您正苦于以下问题:C++ LString::append方法的具体用法?C++ LString::append怎么用?C++ LString::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LString
的用法示例。
在下文中一共展示了LString::append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readLine
void LineInImpl::readLine(LString &r)
{
const int bufsize = 2048;
// at first, check the buffer
while (m_buf.length()>0) {
int pos = m_buf.indexOneOf(m_delim);
if (pos<0) {
// not found, we must read from the stream
break;
}
r.append(m_buf.substr(0, pos+1));
// save remain
m_buf = m_buf.substr(pos+1);
++ m_lineNo;
return; // done
}
// read from the stream
//while (m_pin->available()>0) {
for (;;) {
char sbuf[bufsize];
int res = getImpl()->read(sbuf, 0, bufsize-1);
if (res<=0) {
// Reached to the EOF/EOT
break;
//MB_THROW(IOException, "cannot read from stream");
}
sbuf[res] = '\0';
//printf("read %d:%s", res, sbuf);
m_buf.append(sbuf);
int pos = m_buf.indexOneOf(m_delim);
if (pos>=0) {
r.append(m_buf.substr(0, pos+1));
// save remains
m_buf = m_buf.substr(pos+1);
++ m_lineNo;
return; // done
}
// delimitor isn't found, so we need to read more...
}
// reached to EOF, returns remaining chars
r.append(m_buf);
m_buf = LString();
++ m_lineNo;
return;
}