diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-05-23 17:38:39 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-05-23 17:38:39 +0000 |
| commit | 5ad4640702a80078748b38ebaeda37e69dce1189 (patch) | |
| tree | 9d1ecf8d28f0e9397c2f90565d96ccda6d08b98e /include/cppunit/tools/XmlElement.h | |
| parent | 7edd0684368ed3c43fe2707d1d34d6b7590d9fd6 (diff) | |
| download | cppunit-5ad4640702a80078748b38ebaeda37e69dce1189.tar.gz | |
Include/cppunit/XmlOutputter.
include/cppunit/XmlOutputter.h:
* src/cppunit/XmlOutputter.cpp: extracted class XmlOutputter::Node to
XmlElement. Extracted xml 'prolog' generation to XmlDocument.
* include/cppunit/tools/XmlElement.h:
* src/cppunit/tools/XmlElement.cpp: added, extracted from XmlOutputter::Node.
* include/cppunit/tools/XmlDocument.h:
* src/cppunit/tools/XmlDocument.cpp: added, extracted from XmlOutputter. Handle
XML document prolog (encoding & style-sheet) and manage the root element.
* src/DllPlugInTester/DllPlugInTester.cpp: bug fix, flag --xsl was ignored.
* examples/cppunittest/XmlOutputterTest.h:
* examples/cppunittest/XmlOutputterTest.cpp: updated for XmlOuputter changes.
extracted tests for XmlOutputter::Node to XmlElementTest
* examples/cppunittest/XmlElementTest.h:
* examples/cppunittest/XmlElementTest.cpp: added, tests extracted from
XmlOutputterTest.
Diffstat (limited to 'include/cppunit/tools/XmlElement.h')
| -rw-r--r-- | include/cppunit/tools/XmlElement.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/include/cppunit/tools/XmlElement.h b/include/cppunit/tools/XmlElement.h new file mode 100644 index 0000000..9b033f4 --- /dev/null +++ b/include/cppunit/tools/XmlElement.h @@ -0,0 +1,72 @@ +#ifndef CPPUNIT_TOOLS_XMLELEMENT_H +#define CPPUNIT_TOOLS_XMLELEMENT_H + +#include <cppunit/Portability.h> + +#if CPPUNIT_NEED_DLL_DECL +#pragma warning( push ) +#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z +#endif + +#include <deque> +#include <string> + + +namespace CppUnit +{ + +class XmlElement; + +#if CPPUNIT_NEED_DLL_DECL + template class CPPUNIT_API std::deque<XmlElement *>; +#endif + + +/*! A XML Element. + */ +class CPPUNIT_API XmlElement +{ +public: + XmlElement( std::string elementName, + std::string content ="" ); + XmlElement( std::string elementName, + int numericContent ); + virtual ~XmlElement(); + + void addAttribute( std::string attributeName, + std::string value ); + void addAttribute( std::string attributeName, + int numericValue ); + void addNode( XmlElement *element ); + + std::string toString( const std::string &indent = "" ) const; + +private: + typedef std::pair<std::string,std::string> Attribute; + + std::string attributesAsString() const; + std::string escape( std::string value ) const; + static std::string asString( int value ); + +private: + std::string m_name; + std::string m_content; + + typedef std::deque<Attribute> Attributes; + Attributes m_attributes; + + typedef std::deque<XmlElement *> Elements; + Elements m_elements; +}; + + + +} // namespace CppUnit + + +#if CPPUNIT_NEED_DLL_DECL +#pragma warning( pop ) +#endif + + +#endif // CPPUNIT_TOOLS_XMLELEMENT_H |
