C++/Tree Mapping Runtime Library
Classes | List of all members
_type Class Reference

Class corresponding to the XML Schema anyType built-in type. More...

#include <elements.hxx>

Classes

class  bad_dom_node_type
 Exception indicating that a DOM node cannot be associated with an object model node. More...
 

Constructors

 _type ()
 Default constructor.
 
template<typename C >
 _type (const C *s)
 Create an instance from a C string.
 
 _type (const type &x, flags f=0, container *c=0)
 Copy constructor.
 
virtual type_clone (flags f=0, container *c=0) const
 Copy the instance polymorphically.
 
template<typename S >
 _type (istream< S > &s, flags f=0, container *c=0)
 Create an instance from a data representation stream.
 
 _type (const xercesc::DOMElement &e, flags f=flags::extract_content, container *c=0)
 Create an instance from a DOM element.
 
 _type (const xercesc::DOMAttr &a, flags f=0, container *c=0)
 Create an instance from a DOM Attribute.
 
template<typename C >
 _type (const std::basic_string< C > &s, const xercesc::DOMElement *e, flags f=0, container *c=0)
 Create an instance from a string fragment.
 
typeoperator= (const type &x)
 Copy assignment operator.
 
const dom_content_optional & dom_content () const
 Return a read-only (constant) reference to the anyType DOM content.
 
dom_content_optional & dom_content ()
 Return a read-write reference to the anyType DOM content.
 
void dom_content (const xercesc::DOMElement &e)
 Set the anyType DOM content.
 
void dom_content (xercesc::DOMElement *e)
 Set the anyType DOM content.
 
void dom_content (const dom_content_optional &d)
 Set the anyType DOM content.
 
const xercesc::DOMDocument & dom_content_document () const
 Return a read-only (constant) reference to the DOM document associated with this anyType instance.
 
xercesc::DOMDocument & dom_content_document ()
 Return a read-write reference to the DOM document associated with this anyType instance.
 
bool null_content () const
 Check for absence of DOM (anyType) and text (anySimpleType) content.
 
const container_container () const
 Get a constant pointer to container, an object model node that contains this instance.
 
container_container ()
 Get a pointer to container, an object model node that contains this instance.
 
virtual void _container (container *c)
 Set this instance's new container, an object model node that contains this instance.
 
const container_root () const
 Get a constant pointer to object model's root node.
 
container_root ()
 Get a pointer to object model's root node.
 
const xercesc::DOMNode * _node () const
 Get a constant pointer to a DOM node associated with this object model node.
 
xercesc::DOMNode * _node ()
 Get a pointer to a DOM node associated with this object model node.
 
void _node (xercesc::DOMNode *n)
 Manually set a DOM node associated with this object model node.
 
bool operator== (const type &x, const type &y)
 Comparison operator. It uses DOM (anyType) or text (anySimpleType) content if present. If the content is missing then the types are assumed unequal.
 
bool operator!= (const type &x, const type &y)
 Comparison operator. It uses DOM (anyType) or text (anySimpleType) content if present. If the content is missing then the types are assumed unequal.
 

Detailed Description

Class corresponding to the XML Schema anyType built-in type.

This class is a base for every generated and built-in type in the C++/Tree mapping.

Constructor & Destructor Documentation

◆ _type() [1/6]

template<typename C >
_type ( const C *  s)
explicit

Create an instance from a C string.

Parameters
sA string to initialize the instance with.

Note that this constructor ignores the string and creates an empty anyType instance. In particular, it will not convert the string into DOM content. The purpose of such a strange constructor is to allow statically-initialized default values of anyType type.

◆ _type() [2/6]

_type ( const type x,
flags  f = 0,
container c = 0 
)

Copy constructor.

Parameters
xAn instance to make a copy of.
fFlags to create the copy with.
cA pointer to the object that will contain the copy.

For polymorphic object models use the _clone function instead.

◆ _type() [3/6]

template<typename S >
_type ( istream< S > &  s,
flags  f = 0,
container c = 0 
)

Create an instance from a data representation stream.

Parameters
sA stream to extract the data from.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

◆ _type() [4/6]

_type ( const xercesc::DOMElement &  e,
flags  f = flags::extract_content,
container c = 0 
)

Create an instance from a DOM element.

Parameters
eA DOM element to extract the data from.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

◆ _type() [5/6]

_type ( const xercesc::DOMAttr &  a,
flags  f = 0,
container c = 0 
)

Create an instance from a DOM Attribute.

Parameters
aA DOM attribute to extract the data from.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

◆ _type() [6/6]

template<typename C >
_type ( const std::basic_string< C > &  s,
const xercesc::DOMElement *  e,
flags  f = 0,
container c = 0 
)

Create an instance from a string fragment.

Parameters
sA string fragment to extract the data from.
eA pointer to DOM element containing the string fragment.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

Member Function Documentation

◆ _clone()

virtual type * _clone ( flags  f = 0,
container c = 0 
) const
inlinevirtual

Copy the instance polymorphically.

Parameters
fFlags to create the copy with.
cA pointer to the object that will contain the copy.
Returns
A pointer to the dynamically allocated copy.

This function ensures that the dynamic type of the instance is used for copying and should be used for polymorphic object models instead of the copy constructor.

◆ operator=()

type & operator= ( const type x)
inline

Copy assignment operator.

Parameters
xAn instance to assign.
Returns
A reference to the instance.

◆ dom_content() [1/5]

const dom_content_optional & dom_content ( ) const

Return a read-only (constant) reference to the anyType DOM content.

Returns
A constant reference to the optional container.

The DOM content is returned as an optional element container, the same container as used for optional element wildcards.

◆ dom_content() [2/5]

dom_content_optional & dom_content ( )

Return a read-write reference to the anyType DOM content.

Returns
A reference to the optional container.

The DOM content is returned as an optional element container, the same container as used for optional element wildcards.

◆ dom_content() [3/5]

void dom_content ( const xercesc::DOMElement &  e)

Set the anyType DOM content.

Parameters
eA new element to set.

This function makes a copy of its argument and sets it as the new DOM content.

◆ dom_content() [4/5]

void dom_content ( xercesc::DOMElement *  e)

Set the anyType DOM content.

Parameters
eA new element to use.

This function will use the passed element directly instead of making a copy. For this to work the element should belong to the DOM document associated with this anyType instance.

See also
dom_content_document

◆ dom_content() [5/5]

void dom_content ( const dom_content_optional &  d)

Set the anyType DOM content.

Parameters
dAn optional container with the new element to set.

If the element is present in d then this function makes a copy of this element and sets it as the new wildcard content. Otherwise the element container is set the 'not present' state.

◆ dom_content_document() [1/2]

const xercesc::DOMDocument & dom_content_document ( ) const

Return a read-only (constant) reference to the DOM document associated with this anyType instance.

Returns
A constant reference to the DOM document.

The DOM document returned by this function is used to store the raw XML content corresponding to the anyType instance.

◆ dom_content_document() [2/2]

xercesc::DOMDocument & dom_content_document ( )

Return a read-write reference to the DOM document associated with this anyType instance.

Returns
A reference to the DOM document.

The DOM document returned by this function is used to store the raw XML content corresponding to the anyType instance.

◆ null_content()

bool null_content ( ) const

Check for absence of DOM (anyType) and text (anySimpleType) content.

Returns
True if there is no content and false otherwise.

This is an optimization function that allows us to check for the lack of content without actually creating its empty representation (that is, empty DOM document for DOM or empty string for text).

◆ _container() [1/3]

const container * _container ( ) const
inline

Get a constant pointer to container, an object model node that contains this instance.

Returns
A constant pointer to container, or 0 if this instance is not contained.

Referenced by _type::_container().

◆ _container() [2/3]

container * _container ( )
inline

Get a pointer to container, an object model node that contains this instance.

Returns
A pointer to container, or 0 if this instance is not contained.

◆ _container() [3/3]

virtual void _container ( container c)
inlinevirtual

Set this instance's new container, an object model node that contains this instance.

Parameters
cA pointer to container.

References _type::_container(), and _type::_root().

◆ _root() [1/2]

const container * _root ( ) const
inline

Get a constant pointer to object model's root node.

Returns
A constant pointer to root node, or 0 if this instance is not contained.

Referenced by _type::_container(), and _type::_node().

◆ _root() [2/2]

container * _root ( )
inline

Get a pointer to object model's root node.

Returns
A pointer to root node, or 0 if this instance is not contained.

◆ _node() [1/3]

const xercesc::DOMNode * _node ( ) const
inline

Get a constant pointer to a DOM node associated with this object model node.

Returns
A constant pointer to DOM node, or 0 if none associated.

Referenced by _type::_node().

◆ _node() [2/3]

xercesc::DOMNode * _node ( )
inline

Get a pointer to a DOM node associated with this object model node.

Returns
A pointer to DOM node, or 0 if none associated.

◆ _node() [3/3]

void _node ( xercesc::DOMNode *  n)
inline

Manually set a DOM node associated with this object model node.

The DOM node should be a child of the parent's DOM node. If this object model node is a root of the tree, then it will assume the ownership of the whole DOM document to which this DOM node belongs.

Parameters
nA pointer to DOM node (should be either an element or an attribute).

References _type::_node(), and _type::_root().

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const type x,
const type y 
)
friend

Comparison operator. It uses DOM (anyType) or text (anySimpleType) content if present. If the content is missing then the types are assumed unequal.

Returns
True if the instances are equal, false otherwise.

◆ operator!=

bool operator!= ( const type x,
const type y 
)
friend

Comparison operator. It uses DOM (anyType) or text (anySimpleType) content if present. If the content is missing then the types are assumed unequal.

Returns
True if the instances are not equal, false otherwise.

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

Copyright © 2005-2023 Code Synthesis.