本文整理汇总了C++中AOutputBuffer类的典型用法代码示例。如果您正苦于以下问题:C++ AOutputBuffer类的具体用法?C++ AOutputBuffer怎么用?C++ AOutputBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AOutputBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitPath
void AXmlElement::emitPath(AOutputBuffer& target) const
{
if (mp_Parent)
mp_Parent->emitPath(target);
target.append(AConstant::ASTRING_SLASH);
target.append(m_Name);
}
示例2: emit
/*!
AEmittable
*/
void emit(AOutputBuffer& target) const
{
target.append('{');
target.append(AString::fromPointer(m_Pointer));
if (m_Ownership)
target.append(";owned",6);
target.append('}');
}
示例3: generateRandomWord
void ATextGenerator::generateRandomWord(AOutputBuffer& target, size_t len /* = 0x1 */)
{
if (len < 1)
return;
//a_Lead with consonant
--len;
AString str, strLast("-", 1);
generateRandomString(str, 1, AConstant::CHARSET_LOWERCASE_CONSONANTS);
str.makeUpper();
target.append(str);
bool boolConsonant = false;
while (len > 0)
{
if (boolConsonant)
{
//a_Add a consonant
do
{
str.clear();
generateRandomString(str, 1, AConstant::CHARSET_LOWERCASE_CONSONANTS);
}
while(str.at(0) == strLast.at(0) && ARandomNumberGenerator::get().nextU1() > 220);
target.append(str);
--len;
strLast = str;
boolConsonant = false;
}
else
{
//a_Add a vowel
int twice = 0;
do
{
do
{
str.clear();
generateRandomString(str, 1, AConstant::CHARSET_LOWERCASE_VOWELS);
}
while(str.at(0) == strLast.at(0) && ARandomNumberGenerator::get().nextU1() > 130);
target.append(str);
--len;
strLast = str;
}
while (len > 0 && twice++ < 2 && ARandomNumberGenerator::get().nextU1() > 225);
boolConsonant = true;
}
}
}
示例4: generateUniqueId
void ATextGenerator::generateUniqueId(AOutputBuffer& target, size_t size /* = 32 */)
{
if (size < 16)
ATHROW(NULL, AException::InvalidParameter);
ARope rope;
size_t x = ATime::getTickCount();
rope.append((const char *)&x, sizeof(size_t));
size_t bytesToAdd = size - sizeof(size_t);
while(bytesToAdd >= 4)
{
x = ARandomNumberGenerator::get(ARandomNumberGenerator::Lecuyer).nextU4();
rope.append((const char *)&x, 4);
bytesToAdd -= 4;
}
while(bytesToAdd > 0)
{
x = ARandomNumberGenerator::get(ARandomNumberGenerator::Lecuyer).nextU1();
rope.append((const char *)&x, 1);
--bytesToAdd;
}
AASSERT(NULL, !bytesToAdd);
AString str(rope.getSize() * 2, 256);
ATextConverter::encode64(rope, str);
AASSERT(&str, str.getSize() >= size);
target.append(str, size);
}
示例5: generateRandomString
void ATextGenerator::generateRandomString(AOutputBuffer& target, size_t len, const AString& strCharSet)
{
for (size_t i = 0x0; i < len; ++i)
{
target.append(strCharSet.peek(ARandomNumberGenerator::get().nextRange(strCharSet.getSize())));
}
}
示例6: rope
void ATemplateNodeHandler_MODEL::Node::process(ATemplateContext& context, AOutputBuffer& output)
{
AAutoPtr<AEventVisitor::ScopedEvent> scoped;
if (context.useEventVisitor().isLogging(AEventVisitor::EL_DEBUG))
{
scoped.reset(new AEventVisitor::ScopedEvent(context.useEventVisitor(), ASW("ATemplateNodeHandler_MODEL",26), m_BlockData, AEventVisitor::EL_DEBUG));
}
if (m_BlockData.isEmpty())
return;
AXmlElement *pElement = context.useModel().useRoot().findElement(m_BlockData);
if (pElement)
{
//a_Found object
pElement->emitContent(output);
}
else
{
ARope rope("<!--Unable to find element for '",32);
rope.append(m_BlockData);
rope.append("'-->",4);
output.append(rope);
}
}
示例7: generateRandomData
void ATextGenerator::generateRandomData(AOutputBuffer& target, size_t len)
{
for (size_t i = 0x0; i < len; ++i)
{
target.append(ARandomNumberGenerator::get().nextU1());
}
}
示例8: emitPath
void AFilename::emitPath(AOutputBuffer& target, AFilename::FTYPE ftype, bool noTrailingSlash) const
{
char sep = '/';
if (FTYPE_MSDOS == ftype)
sep = '\\';
//a_Drive
if (m_Drive)
{
switch (ftype)
{
case FTYPE_UNIX:
break;
case FTYPE_CYGWIN:
target.append(ASW("/cygdrive/",10));
target.append(m_Drive);
break;
default:
if (!m_RelativePath)
{
target.append(m_Drive);
target.append(':');
}
}
}
//a_Add slash is not a relative path
if (!m_RelativePath)
target.append(sep);
else if (0 == m_PathNames.size())
{
//a_Special case, relative and no path, default to . or ./ (depends on noTailingSlash flag)
target.append(AConstant::ASTRING_PERIOD);
if (!noTrailingSlash)
target.append(sep);
return;
}
//a_Path
LIST_AString::const_iterator cit = m_PathNames.begin();
while (cit != m_PathNames.end())
{
target.append(*cit);
++cit;
if (cit != m_PathNames.end() || !noTrailingSlash)
target.append(sep);
}
}
示例9: _indent
void AXmlElement::_indent(AOutputBuffer& target, int indent) const
{
while (indent > 0)
{
target.append(AConstant::ASTRING_TWOSPACES);
--indent;
}
}
示例10: emitNoExt
void AFilename::emitNoExt(AOutputBuffer& target, AFilename::FTYPE ftype) const
{
emitPath(target, ftype);
size_t pos = m_Filename.rfind('.');
if (AConstant::npos != pos)
m_Filename.peek(target, 0, pos);
else
target.append(m_Filename);
}
示例11: emit
void AFilename::emit(
AOutputBuffer& target,
AFilename::FTYPE ftype,
bool noTrailingSlash // = false
) const
{
//a_Filename
if (!m_Filename.isEmpty())
{
//a_Path
emitPath(target, ftype);
//a_Append filename
target.append(m_Filename);
}
else
{
//a_Check if trailing slash is not needed
emitPath(target, ftype, noTrailingSlash);
}
}
示例12: emitDrive
void AFilename::emitDrive(AOutputBuffer& target) const
{
target.append(m_Drive);
}
示例13: emitFileUrl
void AFilename::emitFileUrl(AOutputBuffer& target) const
{
target.append(FILE_PREFIX);
emit(target, AFilename::FTYPE_DEFAULT);
}
示例14: emit
void AFragmentSet::emit(AOutputBuffer& target) const
{
target.append(m_Set.at(m_Offset));
}
示例15: emit
void AFragmentCounter::emit(AOutputBuffer& target) const
{
target.append(m_strOdometer);
}