本文整理汇总了C++中nglString::Export方法的典型用法代码示例。如果您正苦于以下问题:C++ nglString::Export方法的具体用法?C++ nglString::Export怎么用?C++ nglString::Export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nglString
的用法示例。
在下文中一共展示了nglString::Export方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteText
int64 nglOStream::WriteText (const nglString& rData)
{
if (rData.IsEmpty() ||
((GetState() != eStreamReady) && (GetState() != eStreamEnd)))
return 0;
// Make sure we have a text conversion context
if (!GetOConv())
return 0;
char buffer[BUFFER_SIZE];
int64 written = 0;
int32 out_offset = 0;
do
{
int64 bytes;
const char* data;
int64 todo;
int32 buffer_free = BUFFER_SIZE;
// FIXME!!!!!!!!!!!
rData.Export(out_offset, buffer, buffer_free, *mpConv);
switch (mpConv->GetState())
{
case eStringConv_OK:
case eStringConv_NeedOutput:
break;
default:
//SetError() FIXME
return written;
}
data = buffer;
todo = BUFFER_SIZE - buffer_free;
// Now write data[0 .. todo-1] with line-ending conversion if necessary
if (mTextFormat == eTextNone)
{
bytes = Write(data, todo, 1);
if (bytes > 0) written += bytes;
if (bytes < todo) return written;
}
else
{
int64 done = 0;
int64 last_ending, ending = -1;
while (ending < todo)
{
last_ending = ending;
do
{
ending++;
}
while ((ending < todo) && (data[ending] != '\n'));
int64 line_size = ending - last_ending - 1;
bytes = Write(&(data[last_ending + 1]), line_size, 1);
if (bytes > 0)
{
done += bytes;
written += bytes;
}
if (bytes < line_size) return written;
if (done < todo)
{
switch (mTextFormat)
{
case eTextDOS : bytes = Write("\r\n", 1, 2) * 2; break;
case eTextUnix: bytes = Write("\n", 1, 1); break;
case eTextMac : bytes = Write("\r", 1, 1); break;
case eTextZero: bytes = Write("\0", 1, 1); break;
case eTextNone: break;
}
if (bytes > 0)
{
done++;
written += bytes;
}
if (bytes < 1) return written;
}
}
}
}
while (mpConv->GetState() == eStringConv_NeedOutput);
return written;
}