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