diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CXMLReader.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CXMLReader.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CXMLReader.cpp index bb42800..8bd3970 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CXMLReader.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CXMLReader.cpp | |||
@@ -1,70 +1,70 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #include "CXMLReaderImpl.h" | 5 | #include "CXMLReaderImpl.h" |
6 | #include "CXMLReader.h" | 6 | #include "CXMLReader.h" |
7 | #include "IReadFile.h" | 7 | #include "IReadFile.h" |
8 | 8 | ||
9 | namespace irr | 9 | namespace irr |
10 | { | 10 | { |
11 | namespace io | 11 | namespace io |
12 | { | 12 | { |
13 | //! Irrlicht implementation of the file read callback for the xml parser | 13 | //! Irrlicht implementation of the file read callback for the xml parser |
14 | class CIrrXMLFileReadCallBack : public IFileReadCallBack | 14 | class CIrrXMLFileReadCallBack : public IFileReadCallBack |
15 | { | 15 | { |
16 | public: | 16 | public: |
17 | 17 | ||
18 | //! construct from FILE pointer | 18 | //! construct from FILE pointer |
19 | CIrrXMLFileReadCallBack(IReadFile* file) | 19 | CIrrXMLFileReadCallBack(IReadFile* file) |
20 | : ReadFile(file) | 20 | : ReadFile(file) |
21 | { | 21 | { |
22 | ReadFile->grab(); | 22 | ReadFile->grab(); |
23 | } | 23 | } |
24 | 24 | ||
25 | //! destructor | 25 | //! destructor |
26 | virtual ~CIrrXMLFileReadCallBack() | 26 | virtual ~CIrrXMLFileReadCallBack() |
27 | { | 27 | { |
28 | ReadFile->drop(); | 28 | ReadFile->drop(); |
29 | } | 29 | } |
30 | 30 | ||
31 | //! Reads an amount of bytes from the file. | 31 | //! Reads an amount of bytes from the file. |
32 | virtual int read(void* buffer, int sizeToRead) | 32 | virtual int read(void* buffer, int sizeToRead) |
33 | { | 33 | { |
34 | return ReadFile->read(buffer, sizeToRead); | 34 | return ReadFile->read(buffer, sizeToRead); |
35 | } | 35 | } |
36 | 36 | ||
37 | //! Returns size of file in bytes | 37 | //! Returns size of file in bytes |
38 | virtual long getSize() const | 38 | virtual long getSize() const |
39 | { | 39 | { |
40 | return ReadFile->getSize(); | 40 | return ReadFile->getSize(); |
41 | } | 41 | } |
42 | 42 | ||
43 | private: | 43 | private: |
44 | 44 | ||
45 | IReadFile* ReadFile; | 45 | IReadFile* ReadFile; |
46 | }; // end class CMyXMLFileReadCallBack | 46 | }; // end class CMyXMLFileReadCallBack |
47 | 47 | ||
48 | 48 | ||
49 | // now create an implementation for IXMLReader using irrXML. | 49 | // now create an implementation for IXMLReader using irrXML. |
50 | 50 | ||
51 | //! Creates an instance of a wide character xml parser. | 51 | //! Creates an instance of a wide character xml parser. |
52 | IXMLReader* createIXMLReader(IReadFile* file) | 52 | IXMLReader* createIXMLReader(IReadFile* file) |
53 | { | 53 | { |
54 | if (!file) | 54 | if (!file) |
55 | return 0; | 55 | return 0; |
56 | 56 | ||
57 | return new CXMLReaderImpl<wchar_t, IReferenceCounted>(new CIrrXMLFileReadCallBack(file)); | 57 | return new CXMLReaderImpl<wchar_t, IReferenceCounted>(new CIrrXMLFileReadCallBack(file)); |
58 | } | 58 | } |
59 | 59 | ||
60 | //! Creates an instance of an UFT-8 or ASCII character xml parser. | 60 | //! Creates an instance of an UFT-8 or ASCII character xml parser. |
61 | IXMLReaderUTF8* createIXMLReaderUTF8(IReadFile* file) | 61 | IXMLReaderUTF8* createIXMLReaderUTF8(IReadFile* file) |
62 | { | 62 | { |
63 | if (!file) | 63 | if (!file) |
64 | return 0; | 64 | return 0; |
65 | 65 | ||
66 | return new CXMLReaderImpl<char, IReferenceCounted>(new CIrrXMLFileReadCallBack(file)); | 66 | return new CXMLReaderImpl<char, IReferenceCounted>(new CIrrXMLFileReadCallBack(file)); |
67 | } | 67 | } |
68 | 68 | ||
69 | } // end namespace | 69 | } // end namespace |
70 | } // end namespace | 70 | } // end namespace |