00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUS_NSPRFILE_H
00020 #define CONEXUS_NSPRFILE_H
00021
00022 #include <conexus/enums.h>
00023 #include <conexus-nspr/filedescriptor.h>
00024
00025 namespace Conexus
00026 {
00027
00028 namespace NSPR
00029 {
00030
00041 class File : public FileDescriptor
00042 {
00043 protected:
00044
00045 File ( const std::string& filename,
00046 long unsigned mode );
00047
00048 public:
00049
00050 typedef ConexusPointer<File> pointer;
00051
00052 CONEXUS_ENDPOINT_GENERIC_CREATE();
00053
00054 static File::pointer create ( const std::string& filename = std::string(),
00055 long unsigned mode = 0 );
00056
00057 virtual ~File();
00058
00062 virtual void open ( const std::string name,
00063 long unsigned mode = FILE_UNCHANGED )
00064 throw ( open_exception );
00065
00070 virtual void open() throw ( open_exception );
00071
00073 std::string filename();
00074
00075 long unsigned mode();
00076
00077 bool eof();
00078
00079 bool throw_eof();
00080
00081 void set_throw_eof ( bool teof = true );
00082
00083 bool is_file() const;
00084
00085 bool is_directory() const;
00086
00087 bool is_other_file_type() const;
00088
00089 size_t size() const;
00090
00103 void set_filename ( std::string d, long unsigned mode = FILE_UNCHANGED ) throw ( open_exception );
00104
00105 sigc::signal<void> signal_filename_changed();
00106
00107 protected:
00108 std::string m_filename;
00109 long unsigned m_mode;
00110 bool m_eof;
00111 bool m_throw_eof;
00112
00113 sigc::signal<void> m_signal_filename_changed;
00114
00121 virtual Data read_data ( long int timeout, size_t s = 0 ) throw ( read_exception );
00122
00123 };
00124
00125 }
00126
00127 }
00128
00129 #endif