00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PANDAFILESTREAM_H
00016 #define PANDAFILESTREAM_H
00017
00018 #include "dtoolbase.h"
00019
00020 #ifdef USE_PANDAFILESTREAM
00021
00022 #include "pandaFileStreamBuf.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class EXPCL_DTOOL IFileStream : public istream {
00034 PUBLISHED:
00035 INLINE IFileStream();
00036 INLINE IFileStream(const char *filename, ios::openmode mode = ios::in);
00037 INLINE ~IFileStream();
00038
00039 INLINE void open(const char *filename, ios::openmode mode = ios::in);
00040
00041 public:
00042 #ifdef _WIN32
00043 INLINE void attach(const char *filename, HANDLE handle, ios::openmode mode = ios::in);
00044 #else
00045 INLINE void attach(const char *filename, int fd, ios::openmode mode = ios::in);
00046 #endif
00047
00048 PUBLISHED:
00049 INLINE void close();
00050
00051 private:
00052 PandaFileStreamBuf _buf;
00053 };
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 class EXPCL_DTOOL OFileStream : public ostream {
00065 PUBLISHED:
00066 INLINE OFileStream();
00067 INLINE OFileStream(const char *filename, ios::openmode mode = ios::out);
00068 INLINE ~OFileStream();
00069
00070 INLINE void open(const char *filename, ios::openmode mode = ios::out);
00071
00072 public:
00073 #ifdef _WIN32
00074 INLINE void attach(const char *filename, HANDLE handle, ios::openmode mode = ios::out);
00075 #else
00076 INLINE void attach(const char *filename, int fd, ios::openmode mode = ios::out);
00077 #endif
00078
00079 PUBLISHED:
00080 INLINE void close();
00081
00082 private:
00083 PandaFileStreamBuf _buf;
00084 };
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 class EXPCL_DTOOL FileStream : public iostream {
00096 PUBLISHED:
00097 INLINE FileStream();
00098 INLINE FileStream(const char *filename, ios::openmode mode = ios::in);
00099 INLINE ~FileStream();
00100
00101 INLINE void open(const char *filename, ios::openmode mode = ios::in);
00102
00103 public:
00104 #ifdef _WIN32
00105 INLINE void attach(const char *filename, HANDLE handle, ios::openmode mode);
00106 #else
00107 INLINE void attach(const char *filename, int fd, ios::openmode mode);
00108 #endif
00109
00110 PUBLISHED:
00111 INLINE void close();
00112
00113 private:
00114 PandaFileStreamBuf _buf;
00115 };
00116
00117 #include "pandaFileStream.I"
00118
00119 typedef IFileStream pifstream;
00120 typedef OFileStream pofstream;
00121 typedef FileStream pfstream;
00122
00123 #else // USE_PANDAFILESTREAM
00124
00125 typedef ifstream pifstream;
00126 typedef ofstream pofstream;
00127 typedef fstream pfstream;
00128
00129 #endif // USE_PANDAFILESTREAM
00130
00131 #endif