source: trunk/contrib/cppunit-1.12.2/include/cppunit/tools/XmlDocument.h @ 876

Last change on this file since 876 was 876, checked in by sam, 9 years ago

contrib: add a precompiled Win32 version of CppUnit and update build system
accordingly.

File size: 2.1 KB
Line 
1#ifndef CPPUNIT_TOOLS_XMLDOCUMENT_H
2#define CPPUNIT_TOOLS_XMLDOCUMENT_H
3
4#include <cppunit/Portability.h>
5
6#if CPPUNIT_NEED_DLL_DECL
7#pragma warning( push )
8#pragma warning( disable: 4251 )  // X needs to have dll-interface to be used by clients of class Z
9#endif
10
11#include <string>
12
13
14CPPUNIT_NS_BEGIN
15
16
17class XmlElement;
18
19
20/*! \brief A XML Document.
21 *
22 * A XmlDocument represents a XML file. It holds a pointer on the root XmlElement
23 * of the document. It also holds the encoding and style sheet used.
24 *
25 * By default, the XML document is stand-alone and tagged with enconding "ISO-8859-1".
26 */
27class CPPUNIT_API XmlDocument
28{
29public:
30  /*! \brief Constructs a XmlDocument object.
31   * \param encoding Encoding used in the XML file (default is Latin-1, ISO-8859-1 ).
32   * \param styleSheet Name of the XSL style sheet file used. If empty then no
33   *                   style sheet will be specified in the output.
34   */
35  XmlDocument( const std::string &encoding = "",
36               const std::string &styleSheet = "" );
37
38  /// Destructor.
39  virtual ~XmlDocument();
40
41  std::string encoding() const;
42  void setEncoding( const std::string &encoding = "" );
43 
44  std::string styleSheet() const;
45  void setStyleSheet( const std::string &styleSheet = "" );
46
47  bool standalone() const;
48
49  /*! \brief set the output document as standalone or not.
50   *
51   *  For the output document, specify wether it's a standalone XML
52   *  document, or not.
53   *
54   *  \param standalone if true, the output will be specified as standalone.
55   *         if false, it will be not.
56   */
57  void setStandalone( bool standalone );
58 
59  void setRootElement( XmlElement *rootElement );
60  XmlElement &rootElement() const;
61
62  std::string toString() const;
63
64private:
65  /// Prevents the use of the copy constructor.
66  XmlDocument( const XmlDocument &copy );
67
68  /// Prevents the use of the copy operator.
69  void operator =( const XmlDocument &copy );
70
71protected:
72  std::string m_encoding;
73  std::string m_styleSheet;
74  XmlElement *m_rootElement;
75  bool m_standalone;
76};
77
78
79#if CPPUNIT_NEED_DLL_DECL
80#pragma warning( pop )
81#endif
82
83
84CPPUNIT_NS_END
85
86#endif  // CPPUNIT_TOOLS_XMLDOCUMENT_H
Note: See TracBrowser for help on using the repository browser.