Menu

[r315]: / trunk / cppunit / include / cppunit / tools / XmlElement.h  Maximize  Restore  History

Download this file

73 lines (49 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
MongoDB Logo MongoDB