当前位置: 首页>>代码示例>>C++>>正文


C++ StringBuilder::appendFormat方法代码示例

本文整理汇总了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]);
  }
}
开发者ID:Ascension64,项目名称:TobEx,代码行数:27,代码来源:MathPresso_DOT.cpp

示例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;
  }
开发者ID:AmesianX,项目名称:asmjit-1,代码行数:25,代码来源:testx86.cpp

示例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);
}
开发者ID:Ascension64,项目名称:TobEx,代码行数:29,代码来源:MathPresso_DOT.cpp

示例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);
}
开发者ID:Ascension64,项目名称:TobEx,代码行数:19,代码来源:MathPresso_DOT.cpp

示例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]);
  }
}
开发者ID:Ascension64,项目名称:TobEx,代码行数:20,代码来源:MathPresso_DOT.cpp

示例6: doVariable

void DotBuilder::doVariable(ASTVariable* element)
{
  _sb.appendFormat("  N_%u [label=\"<F0>", element->getElementId())
     .appendEscaped(Hash<Variable>::dataToKey(element->getVariable()))
     .appendString("\"];\n");
}
开发者ID:Ascension64,项目名称:TobEx,代码行数:6,代码来源:MathPresso_DOT.cpp

示例7: doConstant

void DotBuilder::doConstant(ASTConstant* element)
{
  _sb.appendFormat("  N_%u [label=\"<F0>%f\"];\n", element->getElementId(), element->getValue());
}
开发者ID:Ascension64,项目名称:TobEx,代码行数:4,代码来源:MathPresso_DOT.cpp


注:本文中的StringBuilder::appendFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。