Nebula
Loading...
Searching...
No Matches
bxmlreader.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
15#include "io/streamreader.h"
17
18//------------------------------------------------------------------------------
19namespace IO
20{
22{
24public:
26 BXmlReader();
28 virtual ~BXmlReader();
29
31 virtual bool Open();
33 virtual void Close();
34
36 bool HasNode(const Util::String& path) const;
41
43 void SetToNode(const Util::String& path);
45 bool SetToFirstChild(const Util::String& name = "");
47 bool SetToNextChild(const Util::String& name = "");
49 bool SetToParent();
50
52 bool HasAttr(const char* attr) const;
55
57 Util::String GetString(const char* attr) const;
59 bool GetBool(const char* attr) const;
61 int GetInt(const char* attr) const;
63 float GetFloat(const char* attr) const;
64 #if !__OSX__
66 Math::vec2 GetVec2(const char* attr) const;
68 Math::vec4 GetVec4(const char* attr) const;
70 Math::mat4 GetMat4(const char* attr) const;
71 #endif
73 template<typename T> T Get(const char* attr) const;
74
76 Util::String GetOptString(const char* attr, const Util::String& defaultValue) const;
78 bool GetOptBool(const char* attr, bool defaultValue) const;
80 int GetOptInt(const char* attr, int defaultValue) const;
82 float GetOptFloat(const char* attr, float defaultValue) const;
83 #if !__OSX__
85 Math::vec2 GetOptVec2(const char* attr, const Math::vec2& defaultValue) const;
87 Math::vec4 GetOptVec4(const char* attr, const Math::vec4& defaultValue) const;
89 Math::float2 GetOptVec2(const char* attr, const Math::float2& defaultValue) const;
91 Math::float4 GetOptVec4(const char* attr, const Math::float4& defaultValue) const;
93 Math::mat4 GetOptMat4(const char* attr, const Math::mat4& defaultValue) const;
94 #endif
95
96private:
98};
99
100} // namespace IO
101//------------------------------------------------------------------------------
Helper class for loading binary xml files created with N3's binaryxmlconverter3 tool.
Definition bxmlloaderutil.h:27
Stream reader for binary XML files.
Definition bxmlreader.h:22
Util::String GetString(const char *attr) const
get string attribute value from current node
Definition bxmlreader.cc:209
virtual ~BXmlReader()
destructor
Definition bxmlreader.cc:32
BXmlReader()
constructor
Definition bxmlreader.cc:24
float GetFloat(const char *attr) const
get float attribute value from current node
Definition bxmlreader.cc:247
float GetOptFloat(const char *attr, float defaultValue) const
get optional float attribute value from current node
Definition bxmlreader.cc:345
Math::mat4 GetOptMat4(const char *attr, const Math::mat4 &defaultValue) const
get optional mat4 attribute value from current node
Definition bxmlreader.cc:436
Math::mat4 GetMat4(const char *attr) const
get mat4 attribute value from current node
Definition bxmlreader.cc:283
Math::vec2 GetOptVec2(const char *attr, const Math::vec2 &defaultValue) const
get vec2 attribute value from current node
Definition bxmlreader.cc:364
bool SetToNextChild(const Util::String &name="")
set current node to next sibling node, return false if no more sibling exists
Definition bxmlreader.cc:158
BXmlLoaderUtil loaderUtil
Definition bxmlreader.h:97
bool GetBool(const char *attr) const
get bool attribute value from current node
Definition bxmlreader.cc:229
Util::String GetOptString(const char *attr, const Util::String &defaultValue) const
get optional string attribute value from current node
Definition bxmlreader.cc:293
virtual bool Open()
begin reading from the stream
Definition bxmlreader.cc:44
bool SetToFirstChild(const Util::String &name="")
set current node to first child node, return false if no child exists
Definition bxmlreader.cc:148
bool SetToParent()
set current node to parent, return false if no parent exists
Definition bxmlreader.cc:168
Math::vec4 GetVec4(const char *attr) const
get vec4 attribute value from current node
Definition bxmlreader.cc:266
bool HasNode(const Util::String &path) const
return true if node exists
Definition bxmlreader.cc:79
Util::Array< Util::String > GetAttrs() const
return names of all attrs on current node
Definition bxmlreader.cc:188
Util::String GetCurrentNodeName() const
get short name of current node
Definition bxmlreader.cc:89
bool HasAttr(const char *attr) const
return true if matching attribute exists on current node
Definition bxmlreader.cc:178
int GetInt(const char *attr) const
get int attribute value from current node
Definition bxmlreader.cc:238
Math::vec4 GetOptVec4(const char *attr, const Math::vec4 &defaultValue) const
get optional vec4 attribute value from current node
Definition bxmlreader.cc:382
__DeclareClass(BXmlReader)
int GetOptInt(const char *attr, int defaultValue) const
get optional int attribute value from current node
Definition bxmlreader.cc:327
T Get(const char *attr) const
generic getter for extension types
bool GetOptBool(const char *attr, bool defaultValue) const
get optional bool attribute value from current node
Definition bxmlreader.cc:309
virtual void Close()
end reading from the stream
Definition bxmlreader.cc:67
void SetToNode(const Util::String &path)
set current node as path
Definition bxmlreader.cc:130
Math::vec2 GetVec2(const char *attr) const
get vec2 attribute value from current node
Definition bxmlreader.cc:257
Util::String GetCurrentNodePath() const
get path to current node
Definition bxmlreader.cc:99
Stream reader classes provide a specialized read-interface for a stream.
Definition streamreader.h:24
Nebula's dynamic array class.
Definition array.h:60
Instances of wrapped stream classes.
Definition orientation.cc:10
Definition scalar.h:58
Definition scalar.h:76
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