本文整理汇总了C++中TextStream::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TextStream::Append方法的具体用法?C++ TextStream::Append怎么用?C++ TextStream::Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextStream
的用法示例。
在下文中一共展示了TextStream::Append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
MacroDef::eInvokeMacroStat MacroDef::InvokeMacro
(const ArgSet & args,
TextStream & outText,
const SourceInfo &si) const
{
if (! _name.GetLength())
{
return kInvokeNotInited;
}
if (args.GetNumArgs() != _numArgs)
{
return kInvokeWrongArgCount;
}
TextStream tmp = _definition;
while (tmp.GetLength())
{
bool stat;
char c;
stat = tmp.Consume (c);
assert (stat);
if ('%' != c)
{
outText.Append (c);
}
else
{
// Looks like a macro argument invocation, maybe!
stat = tmp.Consume (c);
assert (stat); // should have already checked for this in
// AppendMacroExpansion()
if ('%' == c)
{
// Not a macro, just an escaped '%'
outText.Append (c);
}
else
{
int idx = c - '0';
TextStream txt;
stat = tmp.Consume (c);
assert (stat); // should have already checked for
// this in AppendMacroExpansion()
assert (c >= '0');
assert (c <= '9');
idx = idx * 10 + (c - '0');
// AppendMacroExpansion should have already checked for
// proper range
assert (idx > 0);
assert (idx < 100);
txt = args.GetArg(idx-1).GetText(); // index is 0-based
outText.SetCurSourceInfo (si);
outText.Append (txt);
}
}
}
return kInvokeNoError;
}