本文整理汇总了C++中OutBuffer::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ OutBuffer::reset方法的具体用法?C++ OutBuffer::reset怎么用?C++ OutBuffer::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutBuffer
的用法示例。
在下文中一共展示了OutBuffer::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
//.........这里部分代码省略.........
if (file.read())
return filename; // error reading file
// Parse into lines
int eof = 0;
for (size_t i = 0; i < file.len && !eof; i++)
{
size_t linestart = i;
for (; i < file.len; i++)
{
switch (file.buffer[i])
{
case '\r':
break;
case '\n':
// Skip if it was preceded by '\r'
if (i && file.buffer[i - 1] == '\r')
goto Lskip;
break;
case 0:
case 0x1A:
eof = 1;
break;
default:
continue;
}
break;
}
buf.reset();
// First, expand the macros.
// Macros are bracketed by % characters.
for (size_t k = 0; k < i - linestart; k++)
{
// The line is file.buffer[linestart..i]
char *line = (char *)&file.buffer[linestart];
if (line[k] == '%')
{
for (size_t j = k + 1; j < i - linestart; j++)
{
if (line[j] == '%')
{
char *p = NULL;
char *palloc = NULL;
if (j - k == 3 && Port::memicmp(&line[k + 1], "@P", 2) == 0)
{
// %@P% is special meaning the path to the .ini file
p = path;
if (!*p)
p = (char *)".";
}
else
{ size_t len2 = j - k;
char tmp[10]; // big enough most of the time
if (len2 <= sizeof(tmp))
p = tmp;
else
{ p = (char *)malloc(len2);
palloc = p;