Asset.h
Go to the documentation of this file.00001 00010 #ifndef __Asset_H__ 00011 #define __Asset_H__ 00012 00013 // Includes 00014 #include "Filename.h" 00015 00016 // Forward declares 00017 class Platform_FileSystem_File; 00018 class DynamicBuffer; 00019 class StaticBuffer; 00020 class ArchiveFile; 00021 class StringId; 00022 00023 // Asset 00024 class Asset 00025 { 00026 public: 00027 // SeekOrigin 00028 enum SeekOrigin 00029 { 00030 SEEK_FROM_START = 0, 00031 SEEK_FROM_CURRENT = 1, 00032 SEEK_FROM_END = 2, 00033 }; 00034 00035 public: 00039 Asset(const StaticBuffer* memoryBuffer); 00040 Asset(DynamicBuffer* memoryBuffer); 00041 Asset(const Filename& filename); 00042 Asset(const StringId& filename); 00043 Asset(const char* filename); 00044 00048 ~Asset(); 00049 00050 Asset(const Asset& asset); 00051 00052 const Asset& operator=(const Asset&); 00053 00054 const Filename& GetFilename() const; 00055 00056 bool Open() const; 00057 bool Create(); 00058 bool Close() const; 00059 int GetSize() const; 00060 int Seek(int offset, SeekOrigin origin = SEEK_FROM_START) const; 00061 int Tell() const; 00062 00063 int Write(const char* value, int count = 1); 00064 int Write(const short* value, int count = 1); 00065 int Write(const int* value, int count = 1); 00066 int Write(const long* value, int count = 1); 00067 int Write(const unsigned char* value, int count = 1); 00068 int Write(const unsigned short* value, int count = 1); 00069 int Write(const unsigned int* value, int count = 1); 00070 int Write(const unsigned long* value, int count = 1); 00071 int Write(const float* value, int count = 1); 00072 int Write(const double* value, int count = 1); 00073 int Write(const bool* value, int count = 1); 00074 00075 int Read(char* value, int count = 1) const; 00076 int Read(short* value, int count = 1) const; 00077 int Read(int* value, int count = 1) const; 00078 int Read(long* value, int count = 1) const; 00079 int Read(unsigned char* value, int count = 1) const; 00080 int Read(unsigned short* value, int count = 1) const; 00081 int Read(unsigned int* value, int count = 1) const; 00082 int Read(unsigned long* value, int count = 1) const; 00083 int Read(float* value, int count = 1) const; 00084 int Read(double* value, int count = 1) const; 00085 int Read(bool* value, int count = 1) const; 00086 00087 private: 00088 void CreateFromFilename(const Filename& filename); 00089 private: 00090 mutable DynamicBuffer* dynamicBuffer_; 00091 mutable const StaticBuffer* staticBuffer_; 00092 mutable ArchiveFile* archiveFile_; 00093 mutable Platform_FileSystem_File* file_; 00094 mutable bool fileIsOpen_; 00095 mutable bool readOnly_; 00096 Filename filename_; 00097 }; 00098 00099 00100 #endif /* __Asset_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
