xmlwriter.h File Reference

XML utilities and functionality for writing/generating a DOM. More...

#include "StringUtilities.h"
#include "XercesIncludes.h"
#include "xmlbase.h"
#include <algorithm>
#include <iterator>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  XMLWriter
 This class generates a DOM tree and associated XML. More...
class  XmlAddPoint
 This class is intended to be used by the XML_ADD_POINT macro and should not be used directly. More...

Defines

#define XML_ADD_POINT(writer, name)   for (XmlAddPoint name(writer, #name); name.isFirstTime(); )
#define XML_ADD_CONTAINER(writer, name, startIter, stopIter)

Functions

template<>
bool XMLWriter::addAttr< std::string > (const char *pName, std::string value)
template<class Iter>
void writeContainerElements (XMLWriter &writer, Iter pStartIter, Iter pStopIter)


Detailed Description

XML utilities and functionality for writing/generating a DOM.

Definition in file xmlwriter.h.


Define Documentation

#define XML_ADD_CONTAINER ( writer,
name,
startIter,
stopIter   ) 

Value:

XML_ADD_POINT (writer, name) \
   { \
      writeContainerElements(writer, startIter, stopIter); \
   }
Writes a container of data to the specified XMLWriter.

  XML_ADD_POINT (writer, my_data)
  {
     vector<int> v(12, 65); // a vector of 12 65's
     XML_ADD_CONTAINER(writer, value, v.begin(), v.end());
  }
The above code will write out the vector of 12 values to the specified XMLWriter. The data can be read back in later with readContainerElements.

Parameters:
writer The XMLWriter to write the data to.
name The name to give each value.
startIter A container iterator specifying the first element to write.
stopIter A container iterator specifying where to stop writing.

Definition at line 606 of file xmlwriter.h.

#define XML_ADD_POINT ( writer,
name   )     for (XmlAddPoint name(writer, #name); name.isFirstTime(); )

Adds an add-point to the XML and to the C++ stack.

This macro causes an add-point to be inserted into the writer, and simultaneously added to an RAII object on the C++ stack. This causes the indentation of the C++ writing code to match the indentation of the resulting XML. This in turn makes it easier to visualize the structure of the resulting XML and makes it impossible mismatch the pushing and popping of add points.

  XML_ADD_POINT (writer, my_add_point) // pushes an add point on the writer
  {
     writer.addAttribute("my_attr", myValue);
  } // pops the add point from the writer

Parameters:
writer The XMLWriter to push the new element / add-point on to.
name The name for the new element.

Definition at line 562 of file xmlwriter.h.


Function Documentation

template<class Iter>
void writeContainerElements ( XMLWriter writer,
Iter  pStartIter,
Iter  pStopIter 
)

This method is intended to be called from the XML_ADD_CONTAINER macro and should not be called directly.

Definition at line 570 of file xmlwriter.h.

template<>
bool XMLWriter::addAttr< std::string > ( const char *  pName,
std::string  value 
)

Explicit template specializations can not go in the class declaration as this is not supported in Studio 11.


Software Development Kit - Opticks 4.9.0 Build 16218