メインページ   モジュール   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TObjectFile.hh

解説を見る。
00001 // =====================================================================
00025 // =====================================================================
00026 #ifndef __TOBJECTFILE_HH
00027 #define __TOBJECTFILE_HH
00028 
00029 #include "Tglobals.h"
00030 #include "TFileProperty.hh"
00031 
00032 
00052 class TObjectFile
00053 {
00054 
00055   public:
00056     enum { 
00057       tSeekBegin = SEEK_SET, 
00058       tSeekCurrent = SEEK_CUR, 
00059       tSeekEnd = SEEK_END
00060     };
00061 
00062   protected:
00063     Tstring theFileName;
00064     Tstring theMode;
00065     TFileStream* theFileStream;
00066     TFileProperty theFileProperty;
00067 
00068   public:
00069     TObjectFile( const Tstring& filename, const Tstring& mode );
00070 
00071   protected:
00072     virtual ~TObjectFile();
00073 
00074   public:
00075     const Tstring& GetFileName() const;
00076     const Tstring& GetMode() const;
00077     TFileStream* GetFileStream() const;
00078     Tvoid SetFileName( const Tstring& filename );
00079     Tvoid SetMode( const Tstring& mode );
00080     const TFileProperty& GetFileProperty() const;
00081 
00082   public:
00083     //inline const Tvoid* SetFileStream() const;
00084     Tvoid SetOffset( Tint offset, Tint whence = tSeekCurrent );
00085     Tint GetOffset();
00086     Tbool IsEnd() const;
00087     Tbool IsError() const;
00088 
00089 };
00090 
00091 inline const Tstring& TObjectFile::GetFileName() const
00092 { 
00093   return theFileName;
00094 }
00095 
00096 inline const Tstring& TObjectFile::GetMode() const
00097 { 
00098   return theMode;
00099 }
00100 
00101 inline TFileStream* TObjectFile::GetFileStream() const
00102 {
00103   return theFileStream;
00104 }
00105 
00106 inline Tvoid TObjectFile::SetFileName( const Tstring& filename )
00107 {
00108   theFileName = filename;
00109   return;
00110 }
00111 
00112 inline Tvoid TObjectFile::SetMode( const Tstring& mode )
00113 {
00114   // reopenしなくては
00115   theMode = mode;
00116   return;
00117 }
00118 
00119 inline Tvoid TObjectFile::SetOffset( Tint offset, Tint whence )
00120 {
00121   fseek( theFileStream, (Tlong)offset, whence );
00122   return;
00123 }
00124 
00125 inline Tint TObjectFile::GetOffset()
00126 {
00127   return (Tint)( ftell( theFileStream ) );
00128 }
00129 
00130 inline const TFileProperty& TObjectFile::GetFileProperty() const
00131 {
00132   return theFileProperty;
00133 }
00134 
00135 inline Tbool TObjectFile::IsEnd() const
00136 {
00137   return ( feof( theFileStream ) != 0 );
00138 }
00139 
00140 inline Tbool TObjectFile::IsError() const
00141 {
00142   return ( ferror( theFileStream ) != 0 );
00143 }
00144 
00145 #endif

CLDAQ - a Class Library for Data AcQuisition (Version 1.10.0)
Go IWAI <goiwai@users.sourceforge.jp>