SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Static Public Member Functions | List of all members
wonderjuce::XmlFactory Class Referencefinal

A class with static functions to create XmlElements from Objects, create Objects from XmlElements and set existing Objects to the values given in an XmlElement. More...

#include <XmlFactory.h>

Static Public Member Functions

static wonder::XmlParsergetParser ()
 Singleton-getter for a wonder::XmlParser implementation that wraps the corresponding static functions of this class. More...
 
static void updateSourceFromXml (const XmlElement *sourceElement, wonder::Source *source)
 Sets the properties of a wonder::Source object to the values given in an XML element. More...
 
static void updateSourceFromCWonderProject (const std::string &cwProjectXml, wonder::Source *source)
 Sets the properties of a wonder::Source object to the values given in an XML formatted string describing a cWONDER project (as defined in cwonder_project.dtd and sent via the /WONDER/project/xmlDump message). More...
 
static void updateSourceCollectionFromCWonderProject (const std::string &cwProjectXml, wonder::SourceCollection &sources)
 Sets the properties of a wonder::SourceCollection to the values given in a cWONDER project XML string. More...
 
static XmlElement * createSourceXml (const wonder::Source &source)
 Creates an XmlElement representing a WONDER source as defined in cwonder_project.dtd. More...
 
static const wonder::Room createRoomFromXml (const XmlElement *roomElement)
 Creates a wonder::Room object from an XmlElement that was created by the createRoomFromXml method. More...
 
static XmlElement * createRoomXml (const wonder::Room &room)
 Creates an XmlElement representing a wonder::Room object. More...
 
static void updateSourceControllerFromXml (const XmlElement *connectionElement, wonder::SourceController *controller)
 Sets the properties of a wonder::SourceController to the values given in an XmlElement that was created using the createConnectionXml method. More...
 
static XmlElement * createConnectionXml (const wonder::SourceController *controller)
 Creates an XmlElement representing a wonder::SourceController's connection state. More...
 
static XmlElement * createGuiXml (float zoomFactor, bool showOthers, bool showNames)
 Creates an XmlElement that holds the parameters of a SPAOP gui that need to be stored. More...
 

Detailed Description

A class with static functions to create XmlElements from Objects, create Objects from XmlElements and set existing Objects to the values given in an XmlElement.

Member Function Documentation

XmlElement * wonderjuce::XmlFactory::createConnectionXml ( const wonder::SourceController controller)
static

Creates an XmlElement representing a wonder::SourceController's connection state.

Stored are the current values of wonder::SourceController::isListening and wonder::SourceController::isSending.

Parameters
controllerThe SourceController that shall be stored to XML.
Returns
an XmlElement containing the room info.
XmlElement * wonderjuce::XmlFactory::createGuiXml ( float  zoomFactor,
bool  showOthers,
bool  showNames 
)
static

Creates an XmlElement that holds the parameters of a SPAOP gui that need to be stored.

Parameters
zoomFactorThe zoom factor of the gui's SourcePanel.
showOthersThe showOthers setting of the gui's SourcePanel.
showNamesThe showNames setting of the gui's SourcePanel.
Returns
an XmlElement containing the corresponding info. The element is named "gui", its attributes are named "zoom" and "show" and "names".
const wonder::Room wonderjuce::XmlFactory::createRoomFromXml ( const XmlElement *  roomElement)
static

Creates a wonder::Room object from an XmlElement that was created by the createRoomFromXml method.

Parameters
roomElementan XmlElement as created by createRoomFromXml.
Returns
a new wonder::Room object set to the values given in the XmlElement. The caller is responsible for deleting the Room object.
XmlElement * wonderjuce::XmlFactory::createRoomXml ( const wonder::Room room)
static

Creates an XmlElement representing a wonder::Room object.

Parameters
roomThe room that shall be stored to XML.
Returns
an XmlElement containing the room info.
XmlElement * wonderjuce::XmlFactory::createSourceXml ( const wonder::Source source)
static

Creates an XmlElement representing a WONDER source as defined in cwonder_project.dtd.

Parameters
sourceThe source that shall be stored to XML.
Returns
an XmlElement representing a WONDER source as defined in cwonder_project.dtd.
wonder::XmlParser * wonderjuce::XmlFactory::getParser ( )
static

Singleton-getter for a wonder::XmlParser implementation that wraps the corresponding static functions of this class.

void wonderjuce::XmlFactory::updateSourceCollectionFromCWonderProject ( const std::string &  cwProjectXml,
wonder::SourceCollection sources 
)
static

Sets the properties of a wonder::SourceCollection to the values given in a cWONDER project XML string.

Parameters
cwProjectXmlAn XML formatted string describing a cWONDER project (as defined in cwonder_project.dtd).
sourcesThe SourceCollection that shall be updated.
void wonderjuce::XmlFactory::updateSourceControllerFromXml ( const XmlElement *  connectionElement,
wonder::SourceController controller 
)
static

Sets the properties of a wonder::SourceController to the values given in an XmlElement that was created using the createConnectionXml method.

cWONDER project XML string. The properties that are set are the isSending and isListening states.

Parameters
connectionElementAn XmlElement created createConnectionXml.
controllerThe SourceController that shall be updated.
void wonderjuce::XmlFactory::updateSourceFromCWonderProject ( const std::string &  cwProjectXml,
wonder::Source source 
)
static

Sets the properties of a wonder::Source object to the values given in an XML formatted string describing a cWONDER project (as defined in cwonder_project.dtd and sent via the /WONDER/project/xmlDump message).

The Source will only be changed if the Xml string is valid and contains information about a source with the same ID.

Parameters
cwProjectXmlAn XML formatted string describing a cWONDER project (as defined in cwonder_project.dtd).
sourceThe Source object that shall be updated.
void wonderjuce::XmlFactory::updateSourceFromXml ( const XmlElement *  sourceElement,
wonder::Source source 
)
static

Sets the properties of a wonder::Source object to the values given in an XML element.

If the XmlElement is invalid, the Source object remains unchanged.

Parameters
sourceElementAn XML element representing a WONDER source as defined in cwonder_project.dtd.
sourceThe Source object that shall be updated.