Initiual commit: AssetImporter source moved from ZFXCE repository to its own repository. PLease do not use the ZFXCE repo any more.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
111
include/IOStream.h
Normal file
111
include/IOStream.h
Normal file
@@ -0,0 +1,111 @@
|
||||
|
||||
/** @file File I/O wrappers for C++. Use interfaces instead of function
|
||||
* pointers to be sure even the silliest men on earth can work with this
|
||||
*/
|
||||
|
||||
#ifndef AI_IOSTREAM_H_INC
|
||||
#define AI_IOSTREAM_H_INC
|
||||
|
||||
#include <string>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "aiTypes.h"
|
||||
#include "aiFileIO.h"
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This header requires C++ to be used.
|
||||
#endif
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Class to handle file I/O for C++
|
||||
*
|
||||
* Derive an own implementation from this interface to provide custom IO handling
|
||||
* to the Importer. If you implement this interface, be sure to also provide an
|
||||
* implementation for IOSystem that creates instances of your custom IO class.
|
||||
*/
|
||||
// ---------------------------------------------------------------------------
|
||||
class IOStream
|
||||
{
|
||||
protected:
|
||||
/** Constructor protected, use IOSystem::Open() to create an instance. */
|
||||
IOStream(void);
|
||||
|
||||
public:
|
||||
// -------------------------------------------------------------------
|
||||
/** Destructor. Deleting the object closes the underlying file,
|
||||
* alternatively you may use IOSystem::Close() to release the file.
|
||||
*/
|
||||
virtual ~IOStream(void);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Read from the file
|
||||
*
|
||||
* See fread() for more details
|
||||
* This fails for write-only files
|
||||
*/
|
||||
// -------------------------------------------------------------------
|
||||
virtual size_t Read(
|
||||
void* pvBuffer,
|
||||
size_t pSize,
|
||||
size_t pCount) = 0;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Write to the file
|
||||
*
|
||||
* See fwrite() for more details
|
||||
* This fails for read-only files
|
||||
*/
|
||||
// -------------------------------------------------------------------
|
||||
virtual size_t Write(
|
||||
const void* pvBuffer,
|
||||
size_t pSize,
|
||||
size_t pCount) = 0;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Set the read/write cursor of the file
|
||||
*
|
||||
* See fseek() for more details
|
||||
*/
|
||||
// -------------------------------------------------------------------
|
||||
virtual aiReturn Seek(
|
||||
size_t pOffset,
|
||||
aiOrigin pOrigin) = 0;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Get the current position of the read/write cursor
|
||||
*
|
||||
* See ftell() for more details
|
||||
*/
|
||||
// -------------------------------------------------------------------
|
||||
virtual size_t Tell(void) const = 0;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns filesize
|
||||
*
|
||||
* Returns the filesize
|
||||
*/
|
||||
// -------------------------------------------------------------------
|
||||
virtual size_t FileSize() const = 0;
|
||||
};
|
||||
// ----------------------------------------------------------------------------
|
||||
inline IOStream::IOStream()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
inline IOStream::~IOStream()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
} //!ns Assimp
|
||||
|
||||
#endif //!!AI_IOSTREAM_H_INC
|
||||
Reference in New Issue
Block a user