Ember

File

Feb 25th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. /*
  2. -----------------------------------------------------------------------------
  3. Filename: File.hpp
  4. -----------------------------------------------------------------------------
  5.  
  6. -----------------------------------------------------------------------------
  7. */
  8.  
  9. // Declare Once
  10. #pragma once
  11. // Includes
  12. #include "Defines.hpp"
  13.  
  14. // Namespace ------------------------------------------------------------------------------
  15. namespace Little
  16. {
  17.     // Class definition -------------------------------------------------------------------
  18.     class File
  19.     {
  20.     public:
  21.         // Constructors
  22.         File();
  23.         File(const File&) {};
  24.         ~File() {};
  25.  
  26.         // Stuff
  27.         enum Mode : Byte { fRead = 1, fWrite = 2, fOverwrite = 4 };
  28.         enum Offset : Byte { fBegin, fCurrent, fEnd };
  29.  
  30.         // Methods
  31.         bool Open(String, Mode);
  32.         template <typename T> T Read();
  33.         template <typename T> T* Read(UInt);
  34.         template <typename T> Int Write(T);
  35.         template <typename T> Int Write(T, UInt);
  36.         Pointer ReadData(UInt);
  37.         UInt Seek(Offset, UInt);
  38.         void Close();
  39.  
  40.         // Reading
  41.  
  42.         // Public members
  43.         UInt FileSize;
  44.         Pointer Data;
  45.         UInt Size;
  46.         UInt Position;
  47.         bool End;
  48.  
  49.     private:
  50.         // Private members
  51.         HANDLE mFile;
  52.         BY_HANDLE_FILE_INFORMATION mFileInfo;
  53.     };
  54. }
  55.  
  56. // Define templated functions
  57. #include "File.tpp"
Advertisement
Add Comment
Please, Sign In to add comment