00001 // ===================================================================== 00002 // $Id: TObjectFile.hh,v 1.1.1.1 2003/06/27 02:56:41 goiwai Exp $ 00003 // $Name: CLDAQ-1-06-02 $ 00004 // ===================================================================== 00005 #ifndef __TOBJECTFILE_HH 00006 #define __TOBJECTFILE_HH 00007 00008 #include "Tglobals.h" 00009 00010 class TObjectFile 00011 { 00012 00013 public: 00014 enum { 00015 tSeekBegin = SEEK_SET, 00016 tSeekCurrent = SEEK_CUR, 00017 tSeekEnd = SEEK_END 00018 }; 00019 00020 protected: 00021 Tstring theFileName; 00022 Tstring theMode; 00023 TFileStream* theFileStream; 00024 00025 public: 00026 TObjectFile( const Tstring& filename, const Tstring& mode ); 00027 00028 protected: 00029 virtual ~TObjectFile(); 00030 00031 public: 00032 const Tstring& GetFileName() const; 00033 const Tstring& GetMode() const; 00034 TFileStream* GetFileStream() const; 00035 00036 Tvoid SetFileName( const Tstring& filename ); 00037 Tvoid SetMode( const Tstring& mode ); 00038 00039 public: 00040 //inline const Tvoid* SetFileStream() const; 00041 Tvoid SetOffset( Tint offset, Tint whence = tSeekCurrent ); 00042 Tint GetOffset(); 00043 00044 }; 00045 00046 inline const Tstring& TObjectFile::GetFileName() const 00047 { 00048 return( theFileName ); 00049 } 00050 00051 inline const Tstring& TObjectFile::GetMode() const 00052 { 00053 return( theMode ); 00054 } 00055 00056 inline TFileStream* TObjectFile::GetFileStream() const 00057 { 00058 return( theFileStream ); 00059 } 00060 00061 inline Tvoid TObjectFile::SetFileName( const Tstring& filename ) 00062 { 00063 theFileName = filename; 00064 return; 00065 } 00066 00067 inline Tvoid TObjectFile::SetMode( const Tstring& mode ) 00068 { 00069 // reopenしなくては 00070 theMode = mode; 00071 return; 00072 } 00073 00074 inline Tvoid TObjectFile::SetOffset( Tint offset, Tint whence ) 00075 { 00076 fseek( theFileStream, (Tlong)offset, whence ); 00077 return; 00078 } 00079 00080 00081 inline Tint TObjectFile::GetOffset() 00082 { 00083 return( (Tint)( ftell( theFileStream ) ) ); 00084 } 00085 00086 #endif