IFile



Describes minimum requirements from interface providing access to platform file.

You can find more information in comments below.

class IFile
{
public:
    enum SEEK_FROM // How to set file pointer
    {
        sfBegin, // Starting from the beginning of the file
        sfCurrent, // Starting from current pointer value
        sfEnd // Starting from the end of the file
    };
public:
    virtual String getFilename() = 0; // Return file name
    virtual long long getSize() = 0; // Return file size
    virtual long long getPointer() = 0; // Return pointer position

    virtual bool setPointer(const long long value, const SEEK_FROM seek_from) = 0; // Set pointer in file to new position

    virtual bool Read( // Read data from file to specified buffer. Check not only the result value but also if "read" value is correct!
        const unsigned int size, // Count of bytes to read(should be <= size of buffer)
        unsigned char *buffer, // Destination of read data
        unsigned long &read) = 0; // Store actual number of read bytes
    virtual bool Write( // Write data from specified buffer to file. Check not only the reasul value but also if "written" value is correct!
        const unsigned int size, // Number of bytes to write from the buffer
        unsigned char *buffer, // Buffer which data should be put into file
        unsigned long &written) = 0; // Store actual number of written bytes

    virtual void Release() = 0; // Close file and release the object
};
Namespace: nitisa
Include: Nitisa/Interfaces/IFile.h