Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class File
- {
- public:
- struct Description
- {
- UInt FileAttributes;
- ULong CreationTime;
- ULong LastAccessTime;
- ULong LastWriteTime;
- UInt VolumeSerialNumber;
- ULong FileSize;
- UInt NumberOfLinks;
- ULong FileIndex;
- };
- public:
- // Constructors
- File() : FileSize(0), Data(nullptr), Size(0), Position(0), Opened(0), End(0) {};
- File(const File& other) = delete;
- ~File() { Close(); };
- // Stuff
- enum class Mode : Byte { Read = 1, Write = 2, Overwrite = 4 };
- enum class Offset : Byte { Begin, Current, End };
- // Methods
- Bool Open(String filename, Mode filemode);
- Description GetDescription();
- Bool Allocate(UInt size);
- Void Close();
- // Reading
- template <typename T> T Read();
- template <typename T> T* Read(UInt count);
- template <typename T> Void Read(Void* buffer);
- template <typename T> Void Read(Void* buffer, UInt count);
- template <typename T> Void Read(Array<T> buffer, UInt count);
- // -- //
- String ReadWord();
- // Writing
- template <typename T> Int Write(const T& data);
- template <typename T> Int Write(T data, UInt count);
- // Stuffs
- Void* Load(UInt count);
- UInt Seek(Offset offset, UInt seek);
- // Public members
- Void* Handle;
- Void* Data;
- UInt FileSize;
- UInt Size;
- UInt Position;
- Bool Opened;
- Bool End;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement