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 File( const std::string& filename=std::string(), long unsigned mode=FILE_READ|FILE_WRITE );
00042
00043 public:
00044 typedef ConexusPointer<File> pointer;
00045
00046 static File::pointer create( const std::string& filename=std::string(), long unsigned mode=FILE_READ|FILE_WRITE);
00047
00048 virtual ~File();
00049
00053 virtual void open(const std::string name, long unsigned mode=FILE_UNCHANGED) throw (open_exception);
00054
00059 virtual void open() throw (open_exception);
00060
00062 std::string filename();
00063
00064 long unsigned mode();
00065
00066 bool eof();
00067
00068 bool throw_eof();
00069
00070 void set_throw_eof(bool teof=true);
00071
00084 void set_filename(std::string d, long unsigned mode=FILE_UNCHANGED) throw (open_exception);
00085
00086 sigc::signal<void> signal_filename_changed();
00087
00088 virtual const std::string& object_type() { static std::string s("Conexus::File"); return s; }
00089
00090 protected:
00091 std::string m_filename;
00092 long unsigned m_mode;
00093 bool m_eof;
00094 bool m_throw_eof;
00095
00096 sigc::signal<void> m_signal_filename_changed;
00097
00098 virtual Data::pointer read_data(long int timeout, size_t s = 0) throw (read_exception);
00099
00100 };
00101
00102 }
00103
00104 #endif