Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/platform/File.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _FILE_H_
00004 #define _FILE_H_
00005 
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 
00009 #include <stdio.h>
00010 #include <string>
00011 
00012 namespace platform
00013 {
00017 enum FileAccess
00018 {
00019         FA_READ = 1,
00020         FA_WRITE = 2,
00021         FA_CREATE = 4,
00022         FA_APPEND = 8
00023 };
00024 
00026 class ENGINE_PUBLIC_EXPORT File
00027 {
00028 public:
00029 
00030         File(const std::string& fileName, u32 fileAccess = FA_READ | FA_WRITE);
00031 
00032         ~File();
00033 
00035         const std::string& getFileName();
00036 
00038         bool opened();
00039         
00041         bool eof();
00042 
00044         u32 tell() const;
00045 
00046         void close();
00047 
00049         u32 read(void* buffer, u32 size);
00050         u32 read(void* buffer, u32 size, u32 count);
00051 
00055         u32 read(std::string& str);
00056 
00060         u32 readLine(std::string& line);        
00061 
00063         u32 write(const void* buffer, u32 size);
00064         u32 write(const void* buffer, u32 size, u32 count);
00065 
00068         bool write(const c8* str);
00069         bool write(const std::string& str);
00070 
00072         bool writeLine(const std::string& line);
00073 
00077         bool seek(s32 finalPos, bool relativeMovement = false);
00078 
00080         u32 getPos();
00081 
00083         u32 size();     
00084 
00086         void flush();
00087 
00088 private:
00089 
00091         void openFile();
00092 
00093         FILE* mFile;
00094         std::string mFileName;
00095         u32 mAccessMode;
00096 };
00097 
00098 } // end namespace platform
00099 
00100 #endif

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)