Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irrXML.h

Go to the documentation of this file.

    00001 // Copyright (C) 2002-2009 Nikolaus Gebhardt
    00002 // This file is part of the "Irrlicht Engine" and the "irrXML" project.
    00003 // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
    00004
    00005 #ifndef __IRR_XML_H_INCLUDED__
    00006 #define __IRR_XML_H_INCLUDED__
    00007
    00008 #include <stdio.h>
    00009 #include "IrrCompileConfig.h"
    00010
    00153 namespace irr
    00154 {
    00155 namespace io
    00156 {
    00158         enum ETEXT_FORMAT
    00159         {
    00161                 ETF_ASCII,
    00162
    00164                 ETF_UTF8,
    00165
    00167                 ETF_UTF16_BE,
    00168
    00170                 ETF_UTF16_LE,
    00171
    00173                 ETF_UTF32_BE,
    00174
    00176                 ETF_UTF32_LE
    00177         };
    00178
    00179
    00181         enum EXML_NODE
    00182         {
    00184                 EXN_NONE,
    00185
    00187                 EXN_ELEMENT,
    00188
    00190                 EXN_ELEMENT_END,
    00191
    00193                 EXN_TEXT,
    00194
    00196                 EXN_COMMENT,
    00197
    00199                 EXN_CDATA,
    00200
    00202                 EXN_UNKNOWN
    00203         };
    00204
    00206
    00213         class IFileReadCallBack
    00214         {
    00215         public:
    00216
    00218                 virtual ~IFileReadCallBack() {}
    00219
    00221
    00224                 virtual int read(void* buffer, int sizeToRead) = 0;
    00225
    00227                 virtual long getSize() const = 0;
    00228         };
    00229
    00231
    00236         class IXMLBase
    00237         {
    00238         };
    00239
    00241
    00273         template<class char_type, class super_class>
    00274         class IIrrXMLReader : public super_class
    00275         {
    00276         public:
    00277
    00279                 virtual ~IIrrXMLReader() {}
    00280
    00282
    00283                 virtual bool read() = 0;
    00284
    00286                 virtual EXML_NODE getNodeType() const = 0;
    00287
    00289
    00292                 virtual unsigned int getAttributeCount() const = 0;
    00293
    00295
    00297                 virtual const char_type* getAttributeName(int idx) const = 0;
    00298
    00300
    00302                 virtual const char_type* getAttributeValue(int idx) const = 0;
    00303
    00305
    00307                 virtual const char_type* getAttributeValue(const char_type* name) const = 0;
    00308
    00310
    00314                 virtual const char_type* getAttributeValueSafe(const char_type* name) const = 0;
    00315
    00317
    00320                 virtual int getAttributeValueAsInt(const char_type* name) const = 0;
    00321
    00323
    00326                 virtual int getAttributeValueAsInt(int idx) const = 0;
    00327
    00329
    00332                 virtual float getAttributeValueAsFloat(const char_type* name) const = 0;
    00333
    00335
    00338                 virtual float getAttributeValueAsFloat(int idx) const = 0;
    00339
    00341
    00343                 virtual const char_type* getNodeName() const = 0;
    00344
    00346
    00348                 virtual const char_type* getNodeData() const = 0;
    00349
    00351                 virtual bool isEmptyElement() const = 0;
    00352
    00354
    00358                 virtual ETEXT_FORMAT getSourceFormat() const = 0;
    00359
    00361
    00365                 virtual ETEXT_FORMAT getParserFormat() const = 0;
    00366         };
    00367
    00368
    00370
    00372         typedef unsigned short char16;
    00373
    00375
    00377         typedef unsigned long char32;
    00378
    00380
    00385         typedef IIrrXMLReader<char, IXMLBase> IrrXMLReader;
    00386
    00388
    00393         typedef IIrrXMLReader<char16, IXMLBase> IrrXMLReaderUTF16;
    00394
    00396
    00401         typedef IIrrXMLReader<char32, IXMLBase> IrrXMLReaderUTF32;
    00402
    00403
    00405
    00413         IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename);
    00414
    00416
    00425         IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file);
    00426
    00428
    00440         IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback,
    00441                                                                                                                                 bool deleteCallback = false);
    00442
    00444
    00453         IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename);
    00454
    00456
    00465         IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file);
    00466
    00468
    00480         IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback,
    00481                                                                                                                                                 bool deleteCallback = false);
    00482
    00483
    00485
    00493         IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename);
    00494
    00496
    00505         IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file);
    00506
    00508
    00521         IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback,
    00522                                                                                                                                                 bool deleteCallback = false);
    00523
    00524
    00546 } // end namespace io
    00547 } // end namespace irr
    00548
    00549 #endif // __IRR_XML_H_INCLUDED__
    00550

| The Irrlicht Engine Documentation © 2003-2009 by Nikolaus Gebhardt. Generated on Sun Jan 10 09:24:04 2010 by Doxygen (1.5.6)