X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-xmltooling.git;a=blobdiff_plain;f=xmltooling%2FAbstractComplexElement.h;h=ba8b862ca67d0765d9317582e2ff5ca12f575b49;hp=9f71657c677c1a4ad5ff29770bf1ab0077e91738;hb=77769b2e300d1295b8a5d717d9ede50e27d70cea;hpb=e0b407e9151cbd322a7f16c82ee40b1ce066d631 diff --git a/xmltooling/AbstractComplexElement.h b/xmltooling/AbstractComplexElement.h index 9f71657..ba8b862 100644 --- a/xmltooling/AbstractComplexElement.h +++ b/xmltooling/AbstractComplexElement.h @@ -15,7 +15,7 @@ */ /** - * @file AbstractComplexElement.h + * @file xmltooling/AbstractComplexElement.h * * AbstractXMLObject mixin that implements children */ @@ -34,8 +34,7 @@ namespace xmltooling { /** * AbstractXMLObject mixin that implements children. - * Inherit from this class to implement an element with child objects. - * No unprotected access to them is supplied here. + * Inherit from this class to implement an element with child objects and mixed content. */ class XMLTOOL_API AbstractComplexElement : public virtual AbstractXMLObject { @@ -52,17 +51,29 @@ namespace xmltooling { void removeChild(XMLObject* child); + const XMLCh* getTextContent(unsigned int position=0) const { + return (m_text.size() > position) ? m_text[position] : NULL; + } + + void setTextContent(const XMLCh* value, unsigned int position=0); + protected: AbstractComplexElement() {} /** Copy constructor. */ - AbstractComplexElement(const AbstractComplexElement& src) {} + AbstractComplexElement(const AbstractComplexElement& src); /** * Underlying list of child objects. * Manages the lifetime of the children. */ std::list m_children; + + /** + * Interstitial text nodes. + * Needed to support mixed content, and preserve DOM whitespace across rebuilds. + */ + std::vector m_text; }; };