/*!

\ingroup Foundation
\brief Writes a config context tree to a stream as XML.
\details Defined in dmzFoundationXMLUtil.h.
\param[in] Data Config object containing config context to write as XML.
\param[in] stream Stream to write XML.
\param[in] Mode Mask specifying file generation mode.
\param[in] log Pointer to Log used for error reporting.
\sa dmz::ConfigPrettyPrint\n dmz::ConfigStripGlobal

*/
dmz::Boolean
dmz::format_config_to_xml (
      const Config &Data,
      Stream &stream,
      const UInt32 Mode,
      Log *log) {

   stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;

   if (Mode & ConfigStripGlobal) {

      ConfigIterator it;
      Config data;

      Boolean result (Data.get_first_config (it, data));

      while (result) {

         local_write_config (data, (ConfigPrettyPrint & Mode) ? 0 : -1, stream);
         result = Data.get_next_config (it, data);
      }
   }
   else { local_write_config (Data, (ConfigPrettyPrint & Mode) ? 0 : -1, stream); }

   return True;
}
Beispiel #2
0
/*!

\ingroup Foundation
\brief Writes a config context tree to a stream as XML.
\details Defined in dmzXMLUtil.h.
\param[in] Data Config object containing config context to write as XML.
\param[in] stream Stream to write XML.
\param[in] StripGlobal Strips root of config context tree so it is not included in
the XML.

*/
void
dmz::format_config_to_xml (
      const Config &Data,
      Stream &stream,
      const Boolean StripGlobal) {

   if (StripGlobal) {

      ConfigIterator it;
      Config data;

      Boolean result (Data.get_first_config (it, data));

      while (result) {

         local_write_config (data, 0, stream);
         result = Data.get_next_config (it, data);
      }
   }
   else { local_write_config (Data, 0, stream); }
}