5#ifndef NIRT_XML_HPP_INCLUDED
6#define NIRT_XML_HPP_INCLUDED
8#include <nirtcpp/core/engine/NirtCompileConfig.hpp>
9#include <nirtcpp/core/engine/irrArray.hpp>
10#include <nirtcpp/core/engine/irrString.hpp>
226 virtual int read(
void* buffer,
int sizeToRead) = 0;
275 template<
class char_type,
class super_
class>
375 template<
class char_type,
class super_
class>
407 const char_type* attr1Name = 0,
const char_type* attr1Value = 0,
408 const char_type* attr2Name = 0,
const char_type* attr2Value = 0,
409 const char_type* attr3Name = 0,
const char_type* attr3Value = 0,
410 const char_type* attr4Name = 0,
const char_type* attr4Value = 0,
411 const char_type* attr5Name = 0,
const char_type* attr5Value = 0) = 0;
434 template <
typename T>
440 xmlChar(
char in) : c(
static_cast<T
>(in)) {}
441 xmlChar(
wchar_t in) : c(
static_cast<T
>(in)) {}
442#if defined(__BORLANDC__)
445 xmlChar(
unsigned char in) : c(
static_cast<T
>(in)) {}
446 xmlChar(
unsigned short in) : c(
static_cast<T
>(in)) {}
447 xmlChar(
unsigned int in) : c(
static_cast<T
>(in)) {}
448 xmlChar(
unsigned long in) : c(
static_cast<T
>(in)) {}
450 explicit xmlChar(
unsigned char in) : c(
static_cast<T
>(in)) {}
452#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
453 explicit xmlChar(
unsigned short in) : c(
static_cast<T
>(in)) {}
455 explicit xmlChar(
unsigned int in) : c(
static_cast<T
>(in)) {}
456 explicit xmlChar(
unsigned long in) : c(
static_cast<T
>(in)) {}
458 operator T()
const {
return c; }
459 void operator=(
int t) { c=
static_cast<T
>(t); }
496#ifdef _NIRT_COMPILE_WITH_XML_
507 NIRTCPP_API
IrrXMLReader* IRRCALLCONV createIrrXMLReader(
const char* filename);
519 NIRTCPP_API
IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file);
535 bool deleteCallback =
false);
547 NIRTCPP_API
IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(
const char* filename);
575 bool deleteCallback =
false);
587 NIRTCPP_API
IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(
const char* filename);
616 bool deleteCallback =
false);
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.hpp:23
Callback class for file read abstraction.
Definition irrXML.hpp:216
virtual int read(void *buffer, int sizeToRead)=0
Reads an amount of bytes from the file.
virtual ~IFileReadCallBack()
Destructor.
Definition irrXML.hpp:220
virtual long getSize() const =0
Returns size of file in bytes on success or -1L on failure.
Interface providing easy read access to a XML file.
Definition irrXML.hpp:277
virtual int getAttributeValueAsInt(int idx, int defaultNotFound=0) const =0
Returns the value of an attribute as integer.
virtual int getAttributeValueAsInt(const char_type *name, int defaultNotFound=0) const =0
Returns the value of an attribute as integer.
virtual const char_type * getAttributeValueSafe(const char_type *name) const =0
Returns the value of an attribute in a safe way.
virtual const char_type * getAttributeValue(int idx) const =0
Returns the value of an attribute.
virtual float getAttributeValueAsFloat(const char_type *name, float defaultNotFound=0.f) const =0
Returns the value of an attribute as float.
virtual float getAttributeValueAsFloat(int idx, float defaultNotFound=0.f) const =0
Returns the value of an attribute as float.
virtual EXML_NODE getNodeType() const =0
Returns the type of the current XML node.
virtual bool read()=0
Reads forward to the next xml node.
virtual unsigned int getAttributeCount() const =0
Returns attribute count of the current XML node.
virtual const char_type * getAttributeName(int idx) const =0
Returns name of an attribute.
virtual ETEXT_FORMAT getSourceFormat() const =0
Returns format of the source xml file.
virtual const char_type * getAttributeValue(const char_type *name) const =0
Returns the value of an attribute.
virtual const char_type * getNodeData() const =0
Returns data of the current node.
virtual ~IIrrXMLReader()
Destructor.
Definition irrXML.hpp:281
virtual const char_type * getNodeName() const =0
Returns the name of the current node.
virtual bool isEmptyElement() const =0
Returns if an element is an empty element, like <foo />
virtual ETEXT_FORMAT getParserFormat() const =0
Returns format of the strings returned by the parser.
Interface providing methods for making it easier to write XML files.
Definition irrXML.hpp:377
virtual void writeLineBreak()=0
Writes a line break.
virtual void writeClosingTag(const char_type *name)=0
Writes the closing tag for an element. Like "</foo>".
virtual void writeElement(const char_type *name, bool empty=false, const char_type *attr1Name=0, const char_type *attr1Value=0, const char_type *attr2Name=0, const char_type *attr2Value=0, const char_type *attr3Name=0, const char_type *attr3Value=0, const char_type *attr4Name=0, const char_type *attr4Value=0, const char_type *attr5Name=0, const char_type *attr5Value=0)=0
virtual void writeElement(const char_type *name, bool empty, core::array< core::string< char_type > > &names, core::array< core::string< char_type > > &values)=0
Writes an xml element with any number of attributes.
virtual ~IIrrXMLWriter()
Destructor.
Definition irrXML.hpp:381
virtual void writeText(const char_type *text)=0
Writes a text into the file.
virtual void writeXMLHeader()=0
Writes an xml 1.0 header.
virtual void writeComment(const char_type *comment)=0
Writes a comment into the xml file.
Empty class to be used as parent class for IrrXMLReader.
Definition irrXML.hpp:239
Definition irrXML.hpp:436
ETEXT_FORMAT
Enumeration of all supported source text file formats.
Definition irrXML.hpp:160
@ ETF_ASCII
ASCII, file without byte order mark, or not a text file.
Definition irrXML.hpp:162
@ ETF_UTF32_BE
UTF-32 format, big endian.
Definition irrXML.hpp:174
@ ETF_UTF16_BE
UTF-16 format, big endian.
Definition irrXML.hpp:168
@ ETF_UTF16_LE
UTF-16 format, little endian.
Definition irrXML.hpp:171
@ ETF_UTF8
UTF-8 format.
Definition irrXML.hpp:165
@ ETF_UTF32_LE
UTF-32 format, little endian.
Definition irrXML.hpp:177
EXML_NODE
Enumeration for all xml nodes which are parsed by IrrXMLReader.
Definition irrXML.hpp:183
@ EXN_CDATA
An xml cdata section like <![CDATA[ this is some CDATA ]]>.
Definition irrXML.hpp:201
@ EXN_NONE
No xml node. This is usually the node if you did not read anything yet.
Definition irrXML.hpp:185
@ EXN_COMMENT
An xml comment like <!– I am a comment –> or a DTD definition.
Definition irrXML.hpp:198
@ EXN_ELEMENT_END
End of an xml element such as </foo>.
Definition irrXML.hpp:191
@ EXN_ELEMENT
An xml element such as <foo>.
Definition irrXML.hpp:188
@ EXN_TEXT
Definition irrXML.hpp:195
@ EXN_UNKNOWN
Unknown element.
Definition irrXML.hpp:204
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11