summaryrefslogtreecommitdiff
path: root/include/cppunit/XmlOutputter.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-05-23 17:38:39 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-05-23 17:38:39 +0000
commit5ad4640702a80078748b38ebaeda37e69dce1189 (patch)
tree9d1ecf8d28f0e9397c2f90565d96ccda6d08b98e /include/cppunit/XmlOutputter.h
parent7edd0684368ed3c43fe2707d1d34d6b7590d9fd6 (diff)
downloadcppunit-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/XmlOutputter.h')
-rw-r--r--include/cppunit/XmlOutputter.h60
1 files changed, 10 insertions, 50 deletions
diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h
index 2be3ffb..3336405 100644
--- a/include/cppunit/XmlOutputter.h
+++ b/include/cppunit/XmlOutputter.h
@@ -9,11 +9,8 @@
#endif
#include <cppunit/Outputter.h>
-#include <deque>
#include <iostream>
#include <map>
-#include <string>
-#include <utility>
namespace CppUnit
@@ -22,6 +19,8 @@ namespace CppUnit
class Test;
class TestFailure;
class TestResultCollector;
+class XmlDocument;
+class XmlElement;
/*! \brief Outputs a TestResultCollector in XML format.
@@ -56,63 +55,23 @@ public:
*/
virtual void setStyleSheet( const std::string &styleSheet );
- /*! \brief An XML Element.
- * \warning This class will probably be replaced with an abstract
- * builder in future version.
- */
- class CPPUNIT_API Node
- {
- public:
- Node( std::string elementName,
- std::string content ="" );
- Node( std::string elementName,
- int numericContent );
- virtual ~Node();
-
- void addAttribute( std::string attributeName,
- std::string value );
- void addAttribute( std::string attributeName,
- int numericValue );
- void addNode( Node *node );
-
- 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<Node *> Nodes;
- Nodes m_nodes;
- };
-
-
- virtual void writeProlog();
- virtual void writeTestsResult();
typedef std::map<Test *,TestFailure*> FailedTests;
- virtual Node *makeRootNode();
+ virtual XmlElement *makeRootNode();
virtual void addFailedTests( FailedTests &failedTests,
- Node *rootNode );
+ XmlElement *rootNode );
virtual void addSuccessfulTests( FailedTests &failedTests,
- Node *rootNode );
- virtual void addStatistics( Node *rootNode );
+ XmlElement *rootNode );
+ virtual void addStatistics( XmlElement *rootNode );
virtual void addFailedTest( Test *test,
TestFailure *failure,
int testNumber,
- Node *testsNode );
+ XmlElement *testsNode );
virtual void addFailureLocation( TestFailure *failure,
- Node *testNode );
+ XmlElement *testNode );
virtual void addSuccessfulTest( Test *test,
int testNumber,
- Node *testsNode );
+ XmlElement *testsNode );
protected:
virtual void fillFailedTestsMap( FailedTests &failedTests );
@@ -121,6 +80,7 @@ protected:
std::ostream &m_stream;
std::string m_encoding;
std::string m_styleSheet;
+ XmlDocument *m_xml;
private:
/// Prevents the use of the copy constructor.