Add IReadFile::getType() interface to all users to find out what kind of class implements that interface.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5798 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2019-03-30 13:38:19 +00:00
parent 39e5fdc3e7
commit 0408c9eb52
6 changed files with 60 additions and 0 deletions

View File

@ -1,5 +1,6 @@
--------------------------
Changes in 1.9 (not yet released)
- Add IReadFile::getType() interface to all users to find out what kind of class implements that interface.
- .dae/Collada reader/writer now handle whitespace in texture-filenames with escape characters (handle them as xs:anyURI).
- Add function string::insert.
- EditBox now still allows overwriting characters when the text-length is at max.

34
include/EReadFileType.h Normal file
View File

@ -0,0 +1,34 @@
// Copyright (C) Michael Zeilfelder
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_READ_FILE_TYPES_H_INCLUDED__
#define __E_READ_FILE_TYPES_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace io
{
//! An enumeration for different class types implementing IReadFile
enum EREAD_FILE_TYPE
{
//! CReadFile
ERFT_READ_FILE = MAKE_IRR_ID('r','e','a','d'),
//! CMemoryReadFile
ERFT_MEMORY_READ_FILE = MAKE_IRR_ID('r','m','e','m'),
//! CLimitReadFile
ERFT_LIMIT_READ_FILE = MAKE_IRR_ID('r','l','i','m'),
//! Unknown type
EFIT_UNKNOWN = MAKE_IRR_ID('u','n','k','n'),
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -7,6 +7,7 @@
#include "IReferenceCounted.h"
#include "coreutil.h"
#include "EReadFileType.h"
namespace irr
{
@ -42,6 +43,12 @@ namespace io
//! Get name of file.
/** \return File name as zero terminated character string. */
virtual const io::path& getFileName() const = 0;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const
{
return EFIT_UNKNOWN;
}
};
//! Internal function, please do not use.

View File

@ -46,6 +46,12 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const _IRR_OVERRIDE_
{
return ERFT_LIMIT_READ_FILE;
}
private:
io::path Filename;

View File

@ -43,6 +43,12 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const _IRR_OVERRIDE_
{
return ERFT_MEMORY_READ_FILE;
}
private:
const void *Buffer;

View File

@ -47,6 +47,12 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const _IRR_OVERRIDE_
{
return ERFT_READ_FILE;
}
//! create read file on disk.
static IReadFile* createReadFile(const io::path& fileName);