Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- -----------------------------------------------------------------------------
- Filename: File.hpp
- -----------------------------------------------------------------------------
- -----------------------------------------------------------------------------
- */
- // Declare Once
- #pragma once
- // Includes
- #include "Defines.hpp"
- // Namespace ------------------------------------------------------------------------------
- namespace R3D
- {
- // Class definition -------------------------------------------------------------------
- class File
- {
- public:
- // Constructors
- File() = default;
- File(const File& other) = delete;
- ~File() = default;
- // 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);
- bool Allocate(UInt size);
- 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> Int Write(T data);
- template <typename T> Int Write(T data, UInt count);
- Pointer Load(UInt count);
- UInt Seek(Offset offset, UInt seek);
- void Close();
- // Reading
- // Public members
- UInt FileSize;
- Pointer Data;
- UInt Size;
- UInt Position;
- bool Opened;
- bool End;
- private:
- // Private members
- HANDLE mFile;
- BY_HANDLE_FILE_INFORMATION mFileInfo;
- };
- }
- // Define templated functions
- #include "File.tpp"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement