#ifndef _COMMON_FILE_HPP_ #define _COMMON_FILE_HPP_ #ifndef _COMMON_WINDOWS_HPP_ #include #endif #ifndef _COMMON_STDIO_HPP_ #include #endif #ifndef _COMMON_STRING_HPP_ #include #endif class File { public: enum SeekMethod{SeekSet=SEEK_SET,SeekCur=SEEK_CUR,SeekEnd=SEEK_END}; File(void); File(String pathFileName,String access="rb"); File(const File &someFile); virtual ~File(); File &operator=(const File &someFile); bool operator==(const File &someFile); bool open(String pathFileName,String access="rb"); bool close(void); bool rewind(void); bool seek(long pos,SeekMethod seekMethod=SeekSet)const; DWORD tell(void)const; DWORD length(void)const; const String &pathFileName(void)const; const String &access(void)const; DWORD readLine(String &lineString); DWORD read(void *pData,int extent); DWORD read(BYTE &value); DWORD read(WORD &value); DWORD read(DWORD &value); DWORD read(int &value); DWORD read(double &value); DWORD read(char *lpBuffer,WORD lengthData,int stopChar); DWORD write(int value); DWORD write(double value); DWORD write(BYTE value); DWORD write(WORD value); DWORD write(DWORD value); bool write(const String &string); DWORD write(const void *lpBuffer,DWORD lengthData); bool write(void *pData,DWORD extent); bool writeLine(const String &lineString); bool operator+=(DWORD sizeIncrement); bool operator++(void); bool operator++(int postFixDummy); bool operator-=(DWORD sizeDecrement); bool operator--(void); bool operator--(int postFixDummy); bool flush(void); bool eof(void)const; bool isOkay(void)const; FILE *getFile(void); private: enum {CarriageReturn=0x0D,LineFeed=0x0A,TabChar=0x09,NullChar=0x00}; FILE *mpFilePointer; String mPathFileName; String mAccess; }; inline FILE *File::getFile(void) { return mpFilePointer; } #endif