本文整理汇总了C++中StringBuilder::appendFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuilder::appendFormat方法的具体用法?C++ StringBuilder::appendFormat怎么用?C++ StringBuilder::appendFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuilder
的用法示例。
在下文中一共展示了StringBuilder::appendFormat方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doCall
void DotBuilder::doCall(ASTCall* element)
{
const Vector<ASTElement*>& arguments = element->getArguments();
size_t i, len = arguments.getLength();
size_t celter = len / 2;
_sb.appendFormat(" N_%u [label=\"", element->getElementId());
_sb.appendFormat("<F0>%s", Hash<Function>::dataToKey(element->getFunction()));
for (i = 0; i < len; i++)
{
_sb.appendFormat("<A%u>", (unsigned int)i);
}
_sb.appendString("\"];\n");
for (i = 0; i < len; i++)
{
_sb.appendFormat(" N_%u:A%u -> N_%u:F0;\n",
element->getElementId(),
(unsigned int)i,
arguments[i]->getElementId());
}
for (i = 0; i < len; i++)
{
doElement(arguments[i]);
}
}
示例2: run
virtual bool run(void* _func, StringBuilder& result, StringBuilder& expected)
{
typedef void (*Func)(int*);
Func func = asmjit_cast<Func>(_func);
int i;
int resultBuf[32];
int expectedBuf[32];
for (i = 0; i < ASMJIT_ARRAY_SIZE(resultBuf); i++)
expectedBuf[i] = i * 32;
bool success = true;
func(resultBuf);
for (i = 0; i < ASMJIT_ARRAY_SIZE(resultBuf); i++)
{
result.appendFormat("%d", resultBuf[i]);
expected.appendFormat("%d", expectedBuf[1]);
success &= (resultBuf[i] == expectedBuf[i]);
}
return success;
}
示例3: doOperator
void DotBuilder::doOperator(ASTOperator* element)
{
uint operatorType = element->getOperatorType();
ASTElement* left = element->getLeft();
ASTElement* right = element->getRight();
const char* opString = NULL;
switch (operatorType)
{
case MOPERATOR_ASSIGN: opString = "="; break;
case MOPERATOR_PLUS : opString = "+"; break;
case MOPERATOR_MINUS : opString = "-"; break;
case MOPERATOR_MUL : opString = "*"; break;
case MOPERATOR_DIV : opString = "/"; break;
case MOPERATOR_MOD : opString = "%"; break;
case MOPERATOR_POW : opString = "^"; break;
default:
MP_ASSERT_NOT_REACHED();
}
_sb.appendFormat(" N_%u [label=\"<L>|<F0>%s|<R>\"];\n", element->getElementId(), opString);
_sb.appendFormat(" N_%u:L -> N_%u:F0;\n", element->getElementId(), left->getElementId());
_sb.appendFormat(" N_%u:R -> N_%u:F0;\n", element->getElementId(), right->getElementId());
doElement(left);
doElement(right);
}
示例4: doTransform
void DotBuilder::doTransform(ASTTransform* element)
{
uint transformType = element->getTransformType();
ASTElement* child = element->getChild();
const char* opString = NULL;
switch (transformType)
{
case MTRANSFORM_NONE : opString = ""; break;
case MTRANSFORM_NEGATE: opString = "-"; break;
default:
MP_ASSERT_NOT_REACHED();
}
_sb.appendFormat(" N_%u [label=\"<F0>%s\"];\n", element->getElementId(), opString);
_sb.appendFormat(" N_%u -> N_%u:F0;\n", element->getElementId(), child->getElementId());
doElement(child);
}
示例5: doBlock
void DotBuilder::doBlock(ASTBlock* element)
{
Vector<ASTElement*>& children = element->_elements;
size_t i, len = children.getLength();
_sb.appendFormat(" N_%u [label=\"", element->getElementId());
for (i = 0; i < len; i++) _sb.appendFormat("<F%u> |", (uint)i);
_sb.appendFormat(" \"];\n", element->getElementId());
for (i = 0; i < len; i++)
{
_sb.appendFormat(" N_%u:F%u -> N_%u:F0\n",
element->getElementId(), (uint)i, children[i]->getElementId());
}
for (i = 0; i < len; i++)
{
doElement(children[i]);
}
}
示例6: doVariable
void DotBuilder::doVariable(ASTVariable* element)
{
_sb.appendFormat(" N_%u [label=\"<F0>", element->getElementId())
.appendEscaped(Hash<Variable>::dataToKey(element->getVariable()))
.appendString("\"];\n");
}
示例7: doConstant
void DotBuilder::doConstant(ASTConstant* element)
{
_sb.appendFormat(" N_%u [label=\"<F0>%f\"];\n", element->getElementId(), element->getValue());
}