Nebula
Loading...
Searching...
No Matches
xmlwriter.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "io/streamwriter.h"
13#include "tinyxml/tinyxml.h"
14
15//------------------------------------------------------------------------------
16namespace IO
17{
19{
21public:
23 XmlWriter();
25 virtual ~XmlWriter();
27 virtual bool Open();
29 virtual void Close();
30
32 bool BeginNode(const Util::String& nodeName);
34 void EndNode();
36 void WriteContent(const Util::String& text);
38 void WriteComment(const Util::String& comment);
40 void WriteRaw(const Util::String& xml);
41
43 void SetString(const Util::String& name, const Util::String& value);
45 void SetBool(const Util::String& name, bool value);
47 void SetInt(const Util::String& name, int value);
49 void SetFloat(const Util::String& name, float value);
50 #if !__OSX__
52 void SetVec2(const Util::String& name, const Math::vec2& value);
54 void SetVec4(const Util::String& name, const Math::vec4& value);
56 void SetMat4(const Util::String& name, const Math::mat4& value);
58 void SetTransform44(const Util::String& name, const Math::transform44& value);
59 #endif
61 template<typename T> void Set(const Util::String& name, const T &value);
62
63private:
66};
67
68} // namespace IO
69//------------------------------------------------------------------------------
70
Stream writer classes provide a specialized write-interface for a stream.
Definition streamwriter.h:22
Write XML-formatted data to a stream.
Definition xmlwriter.h:19
void SetBool(const Util::String &name, bool value)
set bool attribute on current node
Definition xmlwriter.cc:185
void SetFloat(const Util::String &name, float value)
set float attribute on current node
Definition xmlwriter.cc:209
void Set(const Util::String &name, const T &value)
generic setter, template specializations implemented in nebula3/code/addons/nebula2
__DeclareClass(XmlWriter)
void SetVec4(const Util::String &name, const Math::vec4 &value)
set vec4 attribute on current node
Definition xmlwriter.cc:222
void SetString(const Util::String &name, const Util::String &value)
set string attribute on current node
Definition xmlwriter.cc:172
void SetVec2(const Util::String &name, const Math::vec2 &value)
set vec2 attribute on current node
Definition xmlwriter.cc:259
virtual ~XmlWriter()
destructor
Definition xmlwriter.cc:31
void SetMat4(const Util::String &name, const Math::mat4 &value)
set mat4 attribute on current node
Definition xmlwriter.cc:235
void SetInt(const Util::String &name, int value)
set int attribute on current node
Definition xmlwriter.cc:197
TiXmlDocument * xmlDocument
Definition xmlwriter.h:64
void WriteContent(const Util::String &text)
write content text
Definition xmlwriter.cc:136
bool BeginNode(const Util::String &nodeName)
begin a new node under the current node
Definition xmlwriter.cc:91
virtual bool Open()
begin writing the stream
Definition xmlwriter.cc:45
XmlWriter()
constructor
Definition xmlwriter.cc:21
virtual void Close()
end writing the stream
Definition xmlwriter.cc:67
void WriteRaw(const Util::String &xml)
write raw XML
Definition xmlwriter.cc:159
void WriteComment(const Util::String &comment)
write a comment
Definition xmlwriter.cc:147
void EndNode()
end current node, set current node to parent
Definition xmlwriter.cc:113
void SetTransform44(const Util::String &name, const Math::transform44 &value)
set transform44 attribute on current node
Definition xmlwriter.cc:248
TiXmlElement * curNode
Definition xmlwriter.h:65
A 4x4 matrix which is described by translation, rotation and scale.
Definition transform44.h:20
Always the top level node.
Definition tinyxml.h:1228
The element is a container class.
Definition tinyxml.h:841
Instances of wrapped stream classes.
Definition orientation.cc:10
A 4x4 single point precision float matrix.
Definition mat4.h:49
A 2-component float vector class.
Definition vec2.h:21
A 4D vector.
Definition vec4.h:24
Nebula's universal string class.
Definition string.h:50