コード例 #1
0
bool InboundXMLCLIProtocol::SendMessage(Variant &message) {
  string xml;
#if (defined(HAS_TINYXML))
  if (!message.SerializeToXml(xml, true)) {
    FATAL("Unable to serialize to XML");
    return false;
  }

  xml += "\r\n\r\n";
  if (_useLengthPadding) {
    uint32_t size = EHTONL((uint32_t) xml.length());
    _outputBuffer.ReadFromBuffer((uint8_t *) & size, 4);
  }
  _outputBuffer.ReadFromString(xml);
  return EnqueueForOutbound();
#else
  FATAL("Unable to serialize to XML, must enable tinyXML");
  return false;
#endif
}
コード例 #2
0
bool XmlVariantProtocol::Serialize(string &rawData, Variant &variant) {
	return variant.SerializeToXml(rawData, false);
}