| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /** @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
|