diff options
author | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
commit | f9158592e1478b2013afc7041d9ed041cf2d2f4a (patch) | |
tree | b16e389d7988700e21b4c9741044cefa536dcbae /libraries/irrlicht-1.8/include/irrXML.h | |
parent | Libraries readme updated with change markers and more of the Irrlicht changes. (diff) | |
download | SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.zip SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.gz SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.bz2 SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.xz |
Update Irrlicht to 1.8.1. Include actual change markers this time. lol
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/include/irrXML.h | 566 |
1 files changed, 0 insertions, 566 deletions
diff --git a/libraries/irrlicht-1.8/include/irrXML.h b/libraries/irrlicht-1.8/include/irrXML.h deleted file mode 100644 index b8331ac..0000000 --- a/libraries/irrlicht-1.8/include/irrXML.h +++ /dev/null | |||
@@ -1,566 +0,0 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine" and the "irrXML" project. | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h | ||
4 | |||
5 | #ifndef __IRR_XML_H_INCLUDED__ | ||
6 | #define __IRR_XML_H_INCLUDED__ | ||
7 | |||
8 | #include <stdio.h> | ||
9 | #include "IrrCompileConfig.h" | ||
10 | |||
11 | /** \mainpage irrXML 1.2 API documentation | ||
12 | <div align="center"><img src="logobig.png" ></div> | ||
13 | |||
14 | \section intro Introduction | ||
15 | |||
16 | Welcome to the irrXML API documentation. | ||
17 | Here you'll find any information you'll need to develop applications with | ||
18 | irrXML. If you look for a tutorial on how to start, take a look at the \ref irrxmlexample, | ||
19 | at the homepage of irrXML at <A HREF="http://www.ambiera.com/irrxml/">www.ambiera.com/irrxml/</A> | ||
20 | or into the SDK in the directory example. | ||
21 | |||
22 | irrXML is intended to be a high speed and easy-to-use XML Parser for C++, and | ||
23 | this documentation is an important part of it. If you have any questions or | ||
24 | suggestions, just send a email to the author of the engine, Nikolaus Gebhardt | ||
25 | (niko (at) irrlicht3d.org). For more informations about this parser, see \ref history. | ||
26 | |||
27 | \section features Features | ||
28 | |||
29 | irrXML provides forward-only, read-only | ||
30 | access to a stream of non validated XML data. It was fully implemented by | ||
31 | Nikolaus Gebhardt. Its current features are: | ||
32 | |||
33 | - It it fast as lighting and has very low memory usage. It was | ||
34 | developed with the intention of being used in 3D games, as it already has been. | ||
35 | - irrXML is very small: It only consists of 60 KB of code and can be added easily | ||
36 | to your existing project. | ||
37 | - Of course, it is platform independent and works with lots of compilers. | ||
38 | - It is able to parse ASCII, UTF-8, UTF-16 and UTF-32 text files, both in | ||
39 | little and big endian format. | ||
40 | - Independent of the input file format, the parser can return all strings in ASCII, UTF-8, | ||
41 | UTF-16 and UTF-32 format. | ||
42 | - With its optional file access abstraction it has the advantage that it can read not | ||
43 | only from files but from any type of data (memory, network, ...). For example when | ||
44 | used with the Irrlicht Engine, it directly reads from compressed .zip files. | ||
45 | - Just like the Irrlicht Engine for which it was originally created, it is extremely easy | ||
46 | to use. | ||
47 | - It has no external dependencies, it does not even need the STL. | ||
48 | |||
49 | Although irrXML has some strenghts, it currently also has the following limitations: | ||
50 | |||
51 | - The input xml file is not validated and assumed to be correct. | ||
52 | |||
53 | \section irrxmlexample Example | ||
54 | |||
55 | The following code demonstrates the basic usage of irrXML. A simple xml | ||
56 | file like this is parsed: | ||
57 | \code | ||
58 | <?xml version="1.0"?> | ||
59 | <config> | ||
60 | <!-- This is a config file for the mesh viewer --> | ||
61 | <model file="dwarf.dea" /> | ||
62 | <messageText caption="Irrlicht Engine Mesh Viewer"> | ||
63 | Welcome to the Mesh Viewer of the "Irrlicht Engine". | ||
64 | </messageText> | ||
65 | </config> | ||
66 | \endcode | ||
67 | |||
68 | The code for parsing this file would look like this: | ||
69 | \code | ||
70 | #include <irrXML.h> | ||
71 | using namespace irr; // irrXML is located in the namespace irr::io | ||
72 | using namespace io; | ||
73 | |||
74 | #include <string> // we use STL strings to store data in this example | ||
75 | |||
76 | void main() | ||
77 | { | ||
78 | // create the reader using one of the factory functions | ||
79 | |||
80 | IrrXMLReader* xml = createIrrXMLReader("config.xml"); | ||
81 | |||
82 | // strings for storing the data we want to get out of the file | ||
83 | std::string modelFile; | ||
84 | std::string messageText; | ||
85 | std::string caption; | ||
86 | |||
87 | // parse the file until end reached | ||
88 | |||
89 | while(xml && xml->read()) | ||
90 | { | ||
91 | switch(xml->getNodeType()) | ||
92 | { | ||
93 | case EXN_TEXT: | ||
94 | // in this xml file, the only text which occurs is the messageText | ||
95 | messageText = xml->getNodeData(); | ||
96 | break; | ||
97 | case EXN_ELEMENT: | ||
98 | { | ||
99 | if (!strcmp("model", xml->getNodeName())) | ||
100 | modelFile = xml->getAttributeValue("file"); | ||
101 | else | ||
102 | if (!strcmp("messageText", xml->getNodeName())) | ||
103 | caption = xml->getAttributeValue("caption"); | ||
104 | } | ||
105 | break; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | // delete the xml parser after usage | ||
110 | delete xml; | ||
111 | } | ||
112 | \endcode | ||
113 | |||
114 | \section howto How to use | ||
115 | |||
116 | Simply add the source files in the /src directory of irrXML to your project. Done. | ||
117 | |||
118 | \section license License | ||
119 | |||
120 | The irrXML license is based on the zlib license. Basicly, this means you can do with | ||
121 | irrXML whatever you want: | ||
122 | |||
123 | Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
124 | |||
125 | This software is provided 'as-is', without any express or implied | ||
126 | warranty. In no event will the authors be held liable for any damages | ||
127 | arising from the use of this software. | ||
128 | |||
129 | Permission is granted to anyone to use this software for any purpose, | ||
130 | including commercial applications, and to alter it and redistribute it | ||
131 | freely, subject to the following restrictions: | ||
132 | |||
133 | 1. The origin of this software must not be misrepresented; you must not | ||
134 | claim that you wrote the original software. If you use this software | ||
135 | in a product, an acknowledgment in the product documentation would be | ||
136 | appreciated but is not required. | ||
137 | |||
138 | 2. Altered source versions must be plainly marked as such, and must not be | ||
139 | misrepresented as being the original software. | ||
140 | |||
141 | 3. This notice may not be removed or altered from any source distribution. | ||
142 | |||
143 | \section history History | ||
144 | |||
145 | As lots of references in this documentation and the source show, this xml | ||
146 | parser has originally been a part of the | ||
147 | <A HREF="http://irrlicht.sourceforge.net" >Irrlicht Engine</A>. But because | ||
148 | the parser has become very useful with the latest release, people asked for a | ||
149 | separate version of it, to be able to use it in non Irrlicht projects. With | ||
150 | irrXML 1.0, this has now been done. | ||
151 | */ | ||
152 | |||
153 | namespace irr | ||
154 | { | ||
155 | namespace io | ||
156 | { | ||
157 | //! Enumeration of all supported source text file formats | ||
158 | enum ETEXT_FORMAT | ||
159 | { | ||
160 | //! ASCII, file without byte order mark, or not a text file | ||
161 | ETF_ASCII, | ||
162 | |||
163 | //! UTF-8 format | ||
164 | ETF_UTF8, | ||
165 | |||
166 | //! UTF-16 format, big endian | ||
167 | ETF_UTF16_BE, | ||
168 | |||
169 | //! UTF-16 format, little endian | ||
170 | ETF_UTF16_LE, | ||
171 | |||
172 | //! UTF-32 format, big endian | ||
173 | ETF_UTF32_BE, | ||
174 | |||
175 | //! UTF-32 format, little endian | ||
176 | ETF_UTF32_LE | ||
177 | }; | ||
178 | |||
179 | |||
180 | //! Enumeration for all xml nodes which are parsed by IrrXMLReader | ||
181 | enum EXML_NODE | ||
182 | { | ||
183 | //! No xml node. This is usually the node if you did not read anything yet. | ||
184 | EXN_NONE, | ||
185 | |||
186 | //! An xml element such as <foo> | ||
187 | EXN_ELEMENT, | ||
188 | |||
189 | //! End of an xml element such as </foo> | ||
190 | EXN_ELEMENT_END, | ||
191 | |||
192 | //! Text within an xml element: <foo> this is the text. </foo> | ||
193 | //! Also text between 2 xml elements: </foo> this is the text. <foo> | ||
194 | EXN_TEXT, | ||
195 | |||
196 | //! An xml comment like <!-- I am a comment --> or a DTD definition. | ||
197 | EXN_COMMENT, | ||
198 | |||
199 | //! An xml cdata section like <![CDATA[ this is some CDATA ]]> | ||
200 | EXN_CDATA, | ||
201 | |||
202 | //! Unknown element. | ||
203 | EXN_UNKNOWN | ||
204 | }; | ||
205 | |||
206 | //! Callback class for file read abstraction. | ||
207 | /** With this, it is possible to make the xml parser read in other | ||
208 | things than just files. The Irrlicht engine is using this for example to | ||
209 | read xml from compressed .zip files. To make the parser read in | ||
210 | any other data, derive a class from this interface, implement the | ||
211 | two methods to read your data and give a pointer to an instance of | ||
212 | your implementation when calling createIrrXMLReader(), | ||
213 | createIrrXMLReaderUTF16() or createIrrXMLReaderUTF32() */ | ||
214 | class IFileReadCallBack | ||
215 | { | ||
216 | public: | ||
217 | |||
218 | //! Destructor | ||
219 | virtual ~IFileReadCallBack() {} | ||
220 | |||
221 | //! Reads an amount of bytes from the file. | ||
222 | /** \param buffer: Pointer to buffer where to read bytes will be written to. | ||
223 | \param sizeToRead: Amount of bytes to read from the file. | ||
224 | \return Returns how much bytes were read. */ | ||
225 | virtual int read(void* buffer, int sizeToRead) = 0; | ||
226 | |||
227 | //! Returns size of file in bytes | ||
228 | virtual long getSize() const = 0; | ||
229 | }; | ||
230 | |||
231 | //! Empty class to be used as parent class for IrrXMLReader. | ||
232 | /** If you need another class as base class for the xml reader, you can do this by creating | ||
233 | the reader using for example new CXMLReaderImpl<char, YourBaseClass>(yourcallback); | ||
234 | The Irrlicht Engine for example needs IReferenceCounted as base class for every object to | ||
235 | let it automaticly reference countend, hence it replaces IXMLBase with IReferenceCounted. | ||
236 | See irrXML.cpp on how this can be done in detail. */ | ||
237 | class IXMLBase | ||
238 | { | ||
239 | }; | ||
240 | |||
241 | //! Interface providing easy read access to a XML file. | ||
242 | /** You can create an instance of this reader using one of the factory functions | ||
243 | createIrrXMLReader(), createIrrXMLReaderUTF16() and createIrrXMLReaderUTF32(). | ||
244 | If using the parser from the Irrlicht Engine, please use IFileSystem::createXMLReader() | ||
245 | instead. | ||
246 | For a detailed intro how to use the parser, see \ref irrxmlexample and \ref features. | ||
247 | |||
248 | The typical usage of this parser looks like this: | ||
249 | \code | ||
250 | #include <irrXML.h> | ||
251 | using namespace irr; // irrXML is located in the namespace irr::io | ||
252 | using namespace io; | ||
253 | |||
254 | void main() | ||
255 | { | ||
256 | // create the reader using one of the factory functions | ||
257 | IrrXMLReader* xml = createIrrXMLReader("config.xml"); | ||
258 | |||
259 | if (xml == 0) | ||
260 | return; // file could not be opened | ||
261 | |||
262 | // parse the file until end reached | ||
263 | while(xml->read()) | ||
264 | { | ||
265 | // based on xml->getNodeType(), do something. | ||
266 | } | ||
267 | |||
268 | // delete the xml parser after usage | ||
269 | delete xml; | ||
270 | } | ||
271 | \endcode | ||
272 | See \ref irrxmlexample for a more detailed example. | ||
273 | */ | ||
274 | template<class char_type, class super_class> | ||
275 | class IIrrXMLReader : public super_class | ||
276 | { | ||
277 | public: | ||
278 | |||
279 | //! Destructor | ||
280 | virtual ~IIrrXMLReader() {} | ||
281 | |||
282 | //! Reads forward to the next xml node. | ||
283 | /** \return Returns false, if there was no further node. */ | ||
284 | virtual bool read() = 0; | ||
285 | |||
286 | //! Returns the type of the current XML node. | ||
287 | virtual EXML_NODE getNodeType() const = 0; | ||
288 | |||
289 | //! Returns attribute count of the current XML node. | ||
290 | /** This is usually | ||
291 | non null if the current node is EXN_ELEMENT, and the element has attributes. | ||
292 | \return Returns amount of attributes of this xml node. */ | ||
293 | virtual unsigned int getAttributeCount() const = 0; | ||
294 | |||
295 | //! Returns name of an attribute. | ||
296 | /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1. | ||
297 | \return Name of the attribute, 0 if an attribute with this index does not exist. */ | ||
298 | virtual const char_type* getAttributeName(int idx) const = 0; | ||
299 | |||
300 | //! Returns the value of an attribute. | ||
301 | /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1. | ||
302 | \return Value of the attribute, 0 if an attribute with this index does not exist. */ | ||
303 | virtual const char_type* getAttributeValue(int idx) const = 0; | ||
304 | |||
305 | //! Returns the value of an attribute. | ||
306 | /** \param name: Name of the attribute. | ||
307 | \return Value of the attribute, 0 if an attribute with this name does not exist. */ | ||
308 | virtual const char_type* getAttributeValue(const char_type* name) const = 0; | ||
309 | |||
310 | //! Returns the value of an attribute in a safe way. | ||
311 | /** Like getAttributeValue(), but does not | ||
312 | return 0 if the attribute does not exist. An empty string ("") is returned then. | ||
313 | \param name: Name of the attribute. | ||
314 | \return Value of the attribute, and "" if an attribute with this name does not exist */ | ||
315 | virtual const char_type* getAttributeValueSafe(const char_type* name) const = 0; | ||
316 | |||
317 | //! Returns the value of an attribute as integer. | ||
318 | /** \param name Name of the attribute. | ||
319 | \return Value of the attribute as integer, and 0 if an attribute with this name does not exist or | ||
320 | the value could not be interpreted as integer. */ | ||
321 | virtual int getAttributeValueAsInt(const char_type* name) const = 0; | ||
322 | |||
323 | //! Returns the value of an attribute as integer. | ||
324 | /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1. | ||
325 | \return Value of the attribute as integer, and 0 if an attribute with this index does not exist or | ||
326 | the value could not be interpreted as integer. */ | ||
327 | virtual int getAttributeValueAsInt(int idx) const = 0; | ||
328 | |||
329 | //! Returns the value of an attribute as float. | ||
330 | /** \param name: Name of the attribute. | ||
331 | \return Value of the attribute as float, and 0 if an attribute with this name does not exist or | ||
332 | the value could not be interpreted as float. */ | ||
333 | virtual float getAttributeValueAsFloat(const char_type* name) const = 0; | ||
334 | |||
335 | //! Returns the value of an attribute as float. | ||
336 | /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1. | ||
337 | \return Value of the attribute as float, and 0 if an attribute with this index does not exist or | ||
338 | the value could not be interpreted as float. */ | ||
339 | virtual float getAttributeValueAsFloat(int idx) const = 0; | ||
340 | |||
341 | //! Returns the name of the current node. | ||
342 | /** Only valid, if the node type is EXN_ELEMENT. | ||
343 | \return Name of the current node or 0 if the node has no name. */ | ||
344 | virtual const char_type* getNodeName() const = 0; | ||
345 | |||
346 | //! Returns data of the current node. | ||
347 | /** Only valid if the node has some | ||
348 | data and it is of type EXN_TEXT, EXN_COMMENT, EXN_CDATA or EXN_UNKNOWN. */ | ||
349 | virtual const char_type* getNodeData() const = 0; | ||
350 | |||
351 | //! Returns if an element is an empty element, like <foo /> | ||
352 | virtual bool isEmptyElement() const = 0; | ||
353 | |||
354 | //! Returns format of the source xml file. | ||
355 | /** It is not necessary to use | ||
356 | this method because the parser will convert the input file format | ||
357 | to the format wanted by the user when creating the parser. This | ||
358 | method is useful to get/display additional informations. */ | ||
359 | virtual ETEXT_FORMAT getSourceFormat() const = 0; | ||
360 | |||
361 | //! Returns format of the strings returned by the parser. | ||
362 | /** This will be UTF8 for example when you created a parser with | ||
363 | IrrXMLReaderUTF8() and UTF32 when it has been created using | ||
364 | IrrXMLReaderUTF32. It should not be necessary to call this | ||
365 | method and only exists for informational purposes. */ | ||
366 | virtual ETEXT_FORMAT getParserFormat() const = 0; | ||
367 | }; | ||
368 | |||
369 | |||
370 | template <typename T> | ||
371 | struct xmlChar | ||
372 | { | ||
373 | T c; | ||
374 | xmlChar<T>() {} | ||
375 | xmlChar<T>(char in) : c(static_cast<T>(in)) {} | ||
376 | xmlChar<T>(wchar_t in) : c(static_cast<T>(in)) {} | ||
377 | explicit xmlChar<T>(unsigned char in) : c(static_cast<T>(in)) {} | ||
378 | explicit xmlChar<T>(unsigned short in) : c(static_cast<T>(in)) {} | ||
379 | explicit xmlChar<T>(unsigned int in) : c(static_cast<T>(in)) {} | ||
380 | explicit xmlChar<T>(unsigned long in) : c(static_cast<T>(in)) {} | ||
381 | operator T() const { return c; } | ||
382 | void operator=(int t) { c=static_cast<T>(t); } | ||
383 | }; | ||
384 | |||
385 | //! defines the utf-16 type. | ||
386 | /** Not using wchar_t for this because | ||
387 | wchar_t has 16 bit on windows and 32 bit on other operating systems. */ | ||
388 | typedef xmlChar<unsigned short> char16; | ||
389 | |||
390 | //! defines the utf-32 type. | ||
391 | /** Not using wchar_t for this because | ||
392 | wchar_t has 16 bit on windows and 32 bit on other operating systems. */ | ||
393 | typedef xmlChar<unsigned int> char32; | ||
394 | |||
395 | //! A UTF-8 or ASCII character xml parser. | ||
396 | /** This means that all character data will be returned in 8 bit ASCII or UTF-8 by this parser. | ||
397 | The file to read can be in any format, it will be converted to UTF-8 if it is not | ||
398 | in this format. | ||
399 | Create an instance of this with createIrrXMLReader(); | ||
400 | See IIrrXMLReader for description on how to use it. */ | ||
401 | typedef IIrrXMLReader<char, IXMLBase> IrrXMLReader; | ||
402 | |||
403 | //! A UTF-16 xml parser. | ||
404 | /** This means that all character data will be returned in UTF-16 by this parser. | ||
405 | The file to read can be in any format, it will be converted to UTF-16 if it is not | ||
406 | in this format. | ||
407 | Create an instance of this with createIrrXMLReaderUTF16(); | ||
408 | See IIrrXMLReader for description on how to use it. */ | ||
409 | typedef IIrrXMLReader<char16, IXMLBase> IrrXMLReaderUTF16; | ||
410 | |||
411 | //! A UTF-32 xml parser. | ||
412 | /** This means that all character data will be returned in UTF-32 by this parser. | ||
413 | The file to read can be in any format, it will be converted to UTF-32 if it is not | ||
414 | in this format. | ||
415 | Create an instance of this with createIrrXMLReaderUTF32(); | ||
416 | See IIrrXMLReader for description on how to use it. */ | ||
417 | typedef IIrrXMLReader<char32, IXMLBase> IrrXMLReaderUTF32; | ||
418 | |||
419 | |||
420 | //! Creates an instance of an UFT-8 or ASCII character xml parser. | ||
421 | /** This means that all character data will be returned in 8 bit ASCII or UTF-8. | ||
422 | The file to read can be in any format, it will be converted to UTF-8 if it is not in this format. | ||
423 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
424 | IFileSystem::createXMLReaderUTF8() instead. | ||
425 | \param filename: Name of file to be opened. | ||
426 | \return Returns a pointer to the created xml parser. This pointer should be | ||
427 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
428 | and the file could not be opened. */ | ||
429 | IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename); | ||
430 | |||
431 | //! Creates an instance of an UFT-8 or ASCII character xml parser. | ||
432 | /** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can | ||
433 | be in any format, it will be converted to UTF-8 if it is not in this format. | ||
434 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
435 | IFileSystem::createXMLReaderUTF8() instead. | ||
436 | \param file: Pointer to opened file, must have been opened in binary mode, e.g. | ||
437 | using fopen("foo.bar", "wb"); The file will not be closed after it has been read. | ||
438 | \return Returns a pointer to the created xml parser. This pointer should be | ||
439 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
440 | and the file could not be opened. */ | ||
441 | IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file); | ||
442 | |||
443 | //! Creates an instance of an UFT-8 or ASCII character xml parser. | ||
444 | /** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can | ||
445 | be in any format, it will be converted to UTF-8 if it is not in this format. | ||
446 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
447 | IFileSystem::createXMLReaderUTF8() instead. | ||
448 | \param callback: Callback for file read abstraction. Implement your own | ||
449 | callback to make the xml parser read in other things than just files. See | ||
450 | IFileReadCallBack for more information about this. | ||
451 | \param deleteCallback: if true, the callback will be deleted after the file | ||
452 | has been read. Otherwise the caller si responsible for cleaning it up. | ||
453 | \return Returns a pointer to the created xml parser. This pointer should be | ||
454 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
455 | and the file could not be opened. */ | ||
456 | IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback, | ||
457 | bool deleteCallback = false); | ||
458 | |||
459 | //! Creates an instance of an UFT-16 xml parser. | ||
460 | /** This means that | ||
461 | all character data will be returned in UTF-16. The file to read can | ||
462 | be in any format, it will be converted to UTF-16 if it is not in this format. | ||
463 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
464 | IFileSystem::createXMLReader() instead. | ||
465 | \param filename: Name of file to be opened. | ||
466 | \return Returns a pointer to the created xml parser. This pointer should be | ||
467 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
468 | and the file could not be opened. */ | ||
469 | IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename); | ||
470 | |||
471 | //! Creates an instance of an UFT-16 xml parser. | ||
472 | /** This means that all character data will be returned in UTF-16. The file to read can | ||
473 | be in any format, it will be converted to UTF-16 if it is not in this format. | ||
474 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
475 | IFileSystem::createXMLReader() instead. | ||
476 | \param file: Pointer to opened file, must have been opened in binary mode, e.g. | ||
477 | using fopen("foo.bar", "wb"); The file will not be closed after it has been read. | ||
478 | \return Returns a pointer to the created xml parser. This pointer should be | ||
479 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
480 | and the file could not be opened. */ | ||
481 | IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file); | ||
482 | |||
483 | //! Creates an instance of an UFT-16 xml parser. | ||
484 | /** This means that all character data will be returned in UTF-16. The file to read can | ||
485 | be in any format, it will be converted to UTF-16 if it is not in this format. | ||
486 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
487 | IFileSystem::createXMLReader() instead. | ||
488 | \param callback: Callback for file read abstraction. Implement your own | ||
489 | callback to make the xml parser read in other things than just files. See | ||
490 | IFileReadCallBack for more information about this. | ||
491 | \param deleteCallback: if true, the callback will be deleted after the file | ||
492 | has been read. Otherwise the caller si responsible for cleaning it up. | ||
493 | \return Returns a pointer to the created xml parser. This pointer should be | ||
494 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
495 | and the file could not be opened. */ | ||
496 | IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback, | ||
497 | bool deleteCallback = false); | ||
498 | |||
499 | |||
500 | //! Creates an instance of an UFT-32 xml parser. | ||
501 | /** This means that all character data will be returned in UTF-32. The file to read can | ||
502 | be in any format, it will be converted to UTF-32 if it is not in this format. | ||
503 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
504 | IFileSystem::createXMLReader() instead. | ||
505 | \param filename: Name of file to be opened. | ||
506 | \return Returns a pointer to the created xml parser. This pointer should be | ||
507 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
508 | and the file could not be opened. */ | ||
509 | IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename); | ||
510 | |||
511 | //! Creates an instance of an UFT-32 xml parser. | ||
512 | /** This means that all character data will be returned in UTF-32. The file to read can | ||
513 | be in any format, it will be converted to UTF-32 if it is not in this format. | ||
514 | if you are using the Irrlicht Engine, it is better not to use this function but | ||
515 | IFileSystem::createXMLReader() instead. | ||
516 | \param file: Pointer to opened file, must have been opened in binary mode, e.g. | ||
517 | using fopen("foo.bar", "wb"); The file will not be closed after it has been read. | ||
518 | \return Returns a pointer to the created xml parser. This pointer should be | ||
519 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
520 | and the file could not be opened. */ | ||
521 | IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file); | ||
522 | |||
523 | //! Creates an instance of an UFT-32 xml parser. | ||
524 | /** This means that | ||
525 | all character data will be returned in UTF-32. The file to read can | ||
526 | be in any format, it will be converted to UTF-32 if it is not in this format. | ||
527 | If you are using the Irrlicht Engine, it is better not to use this function but | ||
528 | IFileSystem::createXMLReader() instead. | ||
529 | \param callback: Callback for file read abstraction. Implement your own | ||
530 | callback to make the xml parser read in other things than just files. See | ||
531 | IFileReadCallBack for more information about this. | ||
532 | \param deleteCallback: if true, the callback will be deleted after the file | ||
533 | has been read. Otherwise the caller si responsible for cleaning it up. | ||
534 | \return Returns a pointer to the created xml parser. This pointer should be | ||
535 | deleted using 'delete' after no longer needed. Returns 0 if an error occured | ||
536 | and the file could not be opened. */ | ||
537 | IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback, | ||
538 | bool deleteCallback = false); | ||
539 | |||
540 | |||
541 | /*! \file irrXML.h | ||
542 | \brief Header file of the irrXML, the Irrlicht XML parser. | ||
543 | |||
544 | This file includes everything needed for using irrXML, | ||
545 | the XML parser of the Irrlicht Engine. To use irrXML, | ||
546 | you only need to include this file in your project: | ||
547 | |||
548 | \code | ||
549 | #include <irrXML.h> | ||
550 | \endcode | ||
551 | |||
552 | It is also common to use the two namespaces in which irrXML is included, | ||
553 | directly after including irrXML.h: | ||
554 | |||
555 | \code | ||
556 | #include <irrXML.h> | ||
557 | using namespace irr; | ||
558 | using namespace io; | ||
559 | \endcode | ||
560 | */ | ||
561 | |||
562 | } // end namespace io | ||
563 | } // end namespace irr | ||
564 | |||
565 | #endif // __IRR_XML_H_INCLUDED__ | ||
566 | |||