00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSFILE_H
00020 #define CONEXUSFILE_H
00021
00022 #include <conexus/enums.h>
00023 #include <conexus/filedescriptor.h>
00024
00029 namespace Conexus
00030 {
00031
00038 class File : public FileDescriptor
00039 {
00040 protected:
00041
00042 File( const std::string& filename,
00043 long unsigned mode );
00044
00045 public:
00046 typedef ConexusPointer<File> pointer;
00047
00048 static File::pointer create( const std::string& filename = std::string(),
00049 long unsigned mode = FILE_READ | FILE_WRITE | FILE_CREATE | FILE_TRUNCATE );
00050
00051 virtual ~File();
00052
00056 virtual void open( const std::string name,
00057 long unsigned mode = FILE_UNCHANGED )
00058 throw ( open_exception);
00059
00064 virtual void open() throw ( open_exception );
00065
00067 std::string filename();
00068
00069 long unsigned mode();
00070
00071 bool eof();
00072
00073 bool throw_eof();
00074
00075 void set_throw_eof( bool teof = true );
00076
00089 void set_filename( std::string d, long unsigned mode = FILE_UNCHANGED ) throw ( open_exception );
00090
00091 sigc::signal<void> signal_filename_changed();
00092
00093 protected:
00094 std::string m_filename;
00095 long unsigned m_mode;
00096 bool m_eof;
00097 bool m_throw_eof;
00098
00099 sigc::signal<void> m_signal_filename_changed;
00100
00101 virtual Data read_data( long int timeout, size_t s = 0 ) throw ( read_exception );
00102
00103 };
00104
00105 }
00106
00107 #endif