xmltooling::AbstractXMLObject Class Reference

An abstract implementation of XMLObject. More...

#include <xmltooling/AbstractXMLObject.h>

Inheritance diagram for xmltooling::AbstractXMLObject:

xmltooling::XMLObject xmltooling::AbstractAttributeExtensibleXMLObject xmltooling::AbstractComplexElement xmltooling::AbstractDOMCachingXMLObject xmltooling::AbstractSimpleElement xmltooling::AbstractXMLObjectMarshaller xmltooling::AbstractXMLObjectUnmarshaller List of all members.

Public Member Functions

void detach ()
 Specialized function for detaching a child object from its parent while disposing of the parent.
const QNamegetElementQName () const
 Gets the QName for this element.
const std::set< Namespace > & getNamespaces () const
 Gets the namespaces that are scoped to this element.
void addNamespace (const Namespace &ns) const
 Adds a namespace to the ones already scoped to this element.
void removeNamespace (const Namespace &ns)
 Removes a namespace from this element.
const QNamegetSchemaType () const
 Gets the XML schema type of this element.
const XMLCh * getXMLID () const
 Gets the value of the ID attribute set on this object, if any.
xmlconstants::xmltooling_bool_t getNil () const
 Returns the xsi:nil property as an explicit enumerated value.
void nil (xmlconstants::xmltooling_bool_t value)
 Sets the xsi:nil property using an enumerated value.
bool hasParent () const
 Checks to see if this object has a parent.
XMLObjectgetParent () const
 Gets the parent of this element or null if there is no parent.
void setParent (XMLObject *parent)
 Sets the parent of this element.

Protected Member Functions

 AbstractXMLObject (const XMLCh *nsURI=NULL, const XMLCh *localName=NULL, const XMLCh *prefix=NULL, const QName *schemaType=NULL)
 Constructor.
 AbstractXMLObject (const AbstractXMLObject &src)
 Copy constructor.
XMLCh * prepareForAssignment (XMLCh *oldValue, const XMLCh *newValue)
 A helper function for derived classes, for assignment of strings.
DateTimeprepareForAssignment (DateTime *oldValue, const DateTime *newValue)
 A helper function for derived classes, for assignment of date/time data.
DateTimeprepareForAssignment (DateTime *oldValue, time_t newValue, bool duration=false)
 A helper function for derived classes, for assignment of date/time data.
DateTimeprepareForAssignment (DateTime *oldValue, const XMLCh *newValue, bool duration=false)
 A helper function for derived classes, for assignment of date/time data.
QNameprepareForAssignment (QName *oldValue, const QName *newValue)
 A helper function for derived classes, for assignment of QName data.
XMLObjectprepareForAssignment (XMLObject *oldValue, XMLObject *newValue)
 A helper function for derived classes, for assignment of (singleton) XML objects.

Protected Attributes

std::set< Namespacem_namespaces
 Set of namespaces associated with the object.
logging::Category & m_log
 Logging object.
XMLCh * m_schemaLocation
 Stores off xsi:schemaLocation attribute.
XMLCh * m_noNamespaceSchemaLocation
 Stores off xsi:noNamespaceSchemaLocation attribute.
xmlconstants::xmltooling_bool_t m_nil
 Stores off xsi:nil attribute.

Detailed Description

An abstract implementation of XMLObject.

This is the primary concrete base class, and supplies basic namespace, type, and parent handling. Most implementation classes should not directly inherit from this class, but rather from the various mixins that supply the rest of the XMLObject interface, as required.


Constructor & Destructor Documentation

xmltooling::AbstractXMLObject::AbstractXMLObject ( const XMLCh *  nsURI = NULL,
const XMLCh *  localName = NULL,
const XMLCh *  prefix = NULL,
const QName schemaType = NULL 
) [protected]

Constructor.

Parameters:
nsURI the namespace of the element
localName the local name of the XML element this Object represents
prefix the namespace prefix to use
schemaType the xsi:type to use


Member Function Documentation

void xmltooling::AbstractXMLObject::addNamespace ( const Namespace ns  )  const [inline, virtual]

Adds a namespace to the ones already scoped to this element.

Parameters:
ns the namespace to add

Implements xmltooling::XMLObject.

void xmltooling::AbstractXMLObject::detach (  )  [virtual]

Specialized function for detaching a child object from its parent while disposing of the parent.

This is not a generic way of detaching any child object, but only of pruning a single child from the root of an XMLObject tree. If the detached XMLObject's parent is itself a child, an exception will be thrown. It's mainly useful for turning a child into the new root of the tree without having to clone the child.

Implements xmltooling::XMLObject.

Reimplemented in xmltooling::AbstractDOMCachingXMLObject.

const QName& xmltooling::AbstractXMLObject::getElementQName (  )  const [inline, virtual]

Gets the QName for this element.

This QName MUST contain the namespace URI, namespace prefix, and local element name.

Returns:
constant reference to the QName for this object

Implements xmltooling::XMLObject.

const std::set<Namespace>& xmltooling::AbstractXMLObject::getNamespaces (  )  const [inline, virtual]

Gets the namespaces that are scoped to this element.

The caller MUST NOT modify the set returned, but may use any non-modifying operations or algorithms on it. Iterators will remain valid unless the set member referenced is removed using the removeNamespace method.

Returns:
the namespaces that are scoped to this element

Implements xmltooling::XMLObject.

xmlconstants::xmltooling_bool_t xmltooling::AbstractXMLObject::getNil (  )  const [inline, virtual]

Returns the xsi:nil property as an explicit enumerated value.

Returns:
the xsi:nil property

Implements xmltooling::XMLObject.

XMLObject* xmltooling::AbstractXMLObject::getParent (  )  const [inline, virtual]

Gets the parent of this element or null if there is no parent.

Returns:
the parent of this element or null

Implements xmltooling::XMLObject.

const QName* xmltooling::AbstractXMLObject::getSchemaType (  )  const [inline, virtual]

Gets the XML schema type of this element.

This translates to contents the xsi:type attribute for the element.

Returns:
XML schema type of this element

Implements xmltooling::XMLObject.

const XMLCh* xmltooling::AbstractXMLObject::getXMLID (  )  const [inline, virtual]

Gets the value of the ID attribute set on this object, if any.

Returns:
an ID value or NULL

Implements xmltooling::XMLObject.

Reimplemented in xmltooling::AbstractAttributeExtensibleXMLObject.

bool xmltooling::AbstractXMLObject::hasParent (  )  const [inline, virtual]

Checks to see if this object has a parent.

Returns:
true if the object has a parent, false if not

Implements xmltooling::XMLObject.

void xmltooling::AbstractXMLObject::nil ( xmlconstants::xmltooling_bool_t  value  )  [inline, virtual]

Sets the xsi:nil property using an enumerated value.

Parameters:
value value to set

Implements xmltooling::XMLObject.

XMLObject* xmltooling::AbstractXMLObject::prepareForAssignment ( XMLObject oldValue,
XMLObject newValue 
) [protected]

A helper function for derived classes, for assignment of (singleton) XML objects.

It is indifferent to whether either the old or the new version of the value is null. This method will do a safe compare of the objects and will also invalidate the DOM if appropriate. Note that since the new value (even if NULL) is always returned, it may be more efficient to discard the return value and just assign independently if a dynamic cast would be involved.

Parameters:
oldValue current value
newValue proposed new value
Returns:
the new value
Exceptions:
XMLObjectException if the new child already has a parent.

QName* xmltooling::AbstractXMLObject::prepareForAssignment ( QName oldValue,
const QName newValue 
) [protected]

A helper function for derived classes, for assignment of QName data.

It invalidates the DOM, frees the old object, and returns the new.

Parameters:
oldValue the current value
newValue the new value
Returns:
the value that should be assigned

DateTime* xmltooling::AbstractXMLObject::prepareForAssignment ( DateTime oldValue,
const XMLCh *  newValue,
bool  duration = false 
) [protected]

A helper function for derived classes, for assignment of date/time data.

It invalidates the DOM, frees the old object, and returns the new.

Parameters:
oldValue the current value
newValue the new value in string form
duration true iff the value is a duration rather than an absolute timestamp
Returns:
the value that should be assigned

DateTime* xmltooling::AbstractXMLObject::prepareForAssignment ( DateTime oldValue,
time_t  newValue,
bool  duration = false 
) [protected]

A helper function for derived classes, for assignment of date/time data.

It invalidates the DOM, frees the old object, and returns the new.

Parameters:
oldValue the current value
newValue the epoch to assign as the new value
duration true iff the value is a duration rather than an absolute timestamp
Returns:
the value that should be assigned

DateTime* xmltooling::AbstractXMLObject::prepareForAssignment ( DateTime oldValue,
const DateTime newValue 
) [protected]

A helper function for derived classes, for assignment of date/time data.

It invalidates the DOM, frees the old object, and returns the new.

Parameters:
oldValue the current value
newValue the new value
Returns:
the value that should be assigned

XMLCh* xmltooling::AbstractXMLObject::prepareForAssignment ( XMLCh *  oldValue,
const XMLCh *  newValue 
) [protected]

A helper function for derived classes, for assignment of strings.

This 'normalizes' newString, and then if it is different from oldString, it invalidates the DOM, frees the old string, and returns the new. If not different, it frees the new string and just returns the old value.

Parameters:
oldValue the current value
newValue the new value
Returns:
the value that should be assigned

void xmltooling::AbstractXMLObject::removeNamespace ( const Namespace ns  )  [inline, virtual]

Removes a namespace from this element.

Parameters:
ns the namespace to remove

Implements xmltooling::XMLObject.

void xmltooling::AbstractXMLObject::setParent ( XMLObject parent  )  [inline, virtual]

Sets the parent of this element.

Parameters:
parent the parent of this element

Implements xmltooling::XMLObject.


The documentation for this class was generated from the following file:
Generated on Mon Oct 19 14:18:34 2009 for xmltooling by  doxygen 1.4.7