00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _SOCKETS_File_H
00033 #define _SOCKETS_File_H
00034
00035 #include "sockets-config.h"
00036 #include "IFile.h"
00037 #include <stdio.h>
00038
00039 #ifdef SOCKETS_NAMESPACE
00040 namespace SOCKETS_NAMESPACE {
00041 #endif
00042
00043
00046 class File : public IFile
00047 {
00048 public:
00049 File();
00050 File(FILE *);
00052 File(const std::string& path, const std::string& mode);
00053 ~File();
00054
00055 bool fopen(const std::string& path, const std::string& mode);
00056 void fclose() const;
00057
00058 size_t fread(char *, size_t, size_t) const;
00059 size_t fwrite(const char *, size_t, size_t);
00060
00061 char *fgets(char *, int) const;
00062 void fprintf(const char *format, ...);
00063
00064 off_t size() const;
00065 bool eof() const;
00066
00067 void reset_read() const;
00068 void reset_write();
00069
00070 const std::string& Path() const;
00071
00072 private:
00073 File(const File& ) {}
00074 File& operator=(const File& ) { return *this; }
00075
00076 std::string m_path;
00077 std::string m_mode;
00078 mutable FILE *m_fil;
00079 bool m_b_close;
00080 mutable long m_rptr;
00081 long m_wptr;
00082 };
00083
00084
00085
00086
00087 #ifdef SOCKETS_NAMESPACE
00088 }
00089 #endif
00090
00091 #endif // _SOCKETS_File_H
00092