1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#include "CXMLReaderImpl.h"
6
#include "CXMLReader.h"
13
//! Irrlicht implementation of the file read callback for the xml parser
14
class CIrrXMLFileReadCallBack : public IFileReadCallBack
18
//! construct from FILE pointer
19
CIrrXMLFileReadCallBack(IReadFile* file)
26
virtual ~CIrrXMLFileReadCallBack()
31
//! Reads an amount of bytes from the file.
32
virtual int read(void* buffer, int sizeToRead)
34
return ReadFile->read(buffer, sizeToRead);
37
//! Returns size of file in bytes
38
virtual long getSize() const
40
return ReadFile->getSize();
46
}; // end class CMyXMLFileReadCallBack
49
// now create an implementation for IXMLReader using irrXML.
51
//! Creates an instance of a wide character xml parser.
52
IXMLReader* createIXMLReader(IReadFile* file)
57
return new CXMLReaderImpl<wchar_t, IReferenceCounted>(new CIrrXMLFileReadCallBack(file));
60
//! Creates an instance of an UFT-8 or ASCII character xml parser.
61
IXMLReaderUTF8* createIXMLReaderUTF8(IReadFile* file)
66
return new CXMLReaderImpl<char, IReferenceCounted>(new CIrrXMLFileReadCallBack(file));