void
ASTCSymbolDelayNode::write(XMLOutputStream& stream) const
{
  if (&stream == NULL) return;

  stream.startElement("apply");
  
  stream.startElement("csymbol");

  stream.setAutoIndent(false);
  
  ASTBase::writeAttributes(stream);

  stream.writeAttribute( "encoding"     , mEncoding );
  stream.writeAttribute( "definitionURL", mDefinitionURL  );

  stream << " " << getName() << " ";
  
  stream.endElement("csymbol");
  
  stream.setAutoIndent(true);

  for (unsigned int n = 0; n < getNumChildren(); n++)
  {
    ASTFunctionBase::getChild(n)->write(stream);
  }
  
  stream.endElement("apply");
}
void
ASTCnExponentialNode::write(XMLOutputStream& stream) const
{
  stream.startElement("cn");

  stream.setAutoIndent(false);

  ASTCnBase::write(stream);

  writeENotation (  getMantissa(), getExponent(), stream);
  
  stream.endElement("cn");
  
  stream.setAutoIndent(true);
}
void
ASTCnIntegerNode::write(XMLOutputStream& stream) const
{
  stream.startElement("cn");

  stream.setAutoIndent(false);

  ASTCnBase::write(stream);

  static const string type = "integer";
  stream.writeAttribute("type", type);

  stream << " " << getInteger() << " ";
  
  stream.endElement("cn");
  
  stream.setAutoIndent(true);
}
void
ASTCiNumberNode::write(XMLOutputStream& stream) const
{
  stream.startElement("ci");

  stream.setAutoIndent(false);
  
  ASTBase::writeAttributes(stream);

  if (isSetDefinitionURL() == true)
  {
    stream.writeAttribute("definitionURL", getDefinitionURL());
  }

  stream << " " << getName() << " ";
  
  stream.endElement("ci");
  
  stream.setAutoIndent(true);
}
Exemple #5
0
void
ASTCnRealNode::write(XMLOutputStream& stream) const
{
  stream.startElement("cn");

  stream.setAutoIndent(false);

  ASTCnBase::write(stream);

  ostringstream output;

  output.precision(LIBSBML_DOUBLE_PRECISION);
  output << getReal();

  string            value_string = output.str();
  string::size_type position     = value_string.find('e');

  if (position == string::npos)
  {
    stream << " " << value_string << " ";
  }
  else
  {
    const string mantissa_string = value_string.substr(0, position);
    const string exponent_string = value_string.substr(position + 1);

    double mantissa = strtod(mantissa_string.c_str(), 0);
    long   exponent = strtol(exponent_string.c_str(), 0, 10);

    this->writeENotation(mantissa, exponent, stream);
  }

  stream.endElement("cn");
  
  stream.setAutoIndent(true);
}