RobWorkProject  24.12.4-
Classes | Static Public Member Functions | List of all members
XMLPropertySaver Class Reference

Class for saving rw::core::PropertyMap to XML. More...

#include <XMLPropertySaver.hpp>

Classes

class  Initializer
 Utility class which initializes local static variables. More...
 

Static Public Member Functions

static xercesc::DOMElement * save (rw::core::PropertyBase::Ptr property, xercesc::DOMDocument *doc)
 Writes a single property to a DOMElement. More...
 
static xercesc::DOMElement * save (const rw::core::PropertyMap &map, xercesc::DOMDocument *doc)
 Writes PropertyMap to a DOMElement. More...
 
static void save (const rw::core::PropertyMap &map, xercesc::DOMElement *element, xercesc::DOMDocument *doc)
 Saves properties of a PropertyMap as childs to element. More...
 
static void save (const rw::core::PropertyMap &map, const std::string &filename)
 Saves the properties of map to file named filename. More...
 
static void write (const rw::core::PropertyMap &map, std::ostream &outstream)
 Writes the properties of map to outstream. More...
 
static xercesc::DOMDocument * createDOMDocument (const rw::core::PropertyMap &map)
 Creates DOMDocument for map. More...
 

Detailed Description

Class for saving rw::core::PropertyMap to XML.

The class support saving all in rw::core::PropertyType defined types.

Member Function Documentation

◆ createDOMDocument()

static xercesc::DOMDocument* createDOMDocument ( const rw::core::PropertyMap map)
static

Creates DOMDocument for map.

IMPORTANT: Remember to call release on the returned DOMDocument

Parameters
map[in] Map of properties
Returns
DOMDocument containing properties.

◆ save() [1/4]

static void save ( const rw::core::PropertyMap map,
const std::string &  filename 
)
static

Saves the properties of map to file named filename.

Throws rw::core::Exception if the type of a property is not supported.

Parameters
map[in] Map of properties to save
filename[in] Filename

◆ save() [2/4]

static xercesc::DOMElement* save ( const rw::core::PropertyMap map,
xercesc::DOMDocument *  doc 
)
static

Writes PropertyMap to a DOMElement.

Constructs a new DOMElement for the document doc and adds the properties in map to it.

Throws rw::core::Expcetion if the type of a property is not supported.

Parameters
map[in] Map of properties to save
doc[in] DOMDocument which should contain the properties
Returns
DOMElement representing map and belonging to doc

◆ save() [3/4]

static void save ( const rw::core::PropertyMap map,
xercesc::DOMElement *  element,
xercesc::DOMDocument *  doc 
)
static

Saves properties of a PropertyMap as childs to element.

Constructs element representing the properties in map and adds these as childs to element.

Throws rw::core::Expcetion if the type of a property is not supported.

Parameters
map[in] Map of properties to save.
element[in] Element to which properties should be stored as children.
doc[in] DOMDocument containing element and which should contain the individual properties

◆ save() [4/4]

static xercesc::DOMElement* save ( rw::core::PropertyBase::Ptr  property,
xercesc::DOMDocument *  doc 
)
static

Writes a single property to a DOMElement.

Constructs a new DOMElement for the document doc and writes the property to it.

Throws rw::core::Exception if the type of the property is not supported.

Parameters
property[in] Property to save
doc[in] DOMDocument which should contain the property representation
Returns
DOMElement representing property and belonging to doc.

◆ write()

static void write ( const rw::core::PropertyMap map,
std::ostream &  outstream 
)
static

Writes the properties of map to outstream.

Throws rw::core::Exception if the type of a property is not supported.

Parameters
map[in] Map of properties to save
outstream[in] Output stream

The documentation for this class was generated from the following file: