Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00011 #include "fvar.hpp"
00012
00013 #define INSERT_IMPLEMENT(TYPE) \
00014 uostream& uostream::operator<< (TYPE x) \
00015 { \
00016 write((char*)&x, sizeof(TYPE)); \
00017 return *this; \
00018 }
00019
00020 #define EXTRACT_IMPLEMENT(TYPE) \
00021 uistream& uistream::operator>> (const TYPE& x) \
00022 { \
00023 read((char*)&x, sizeof(TYPE)); \
00024 return *this; \
00025 }
00026
00027 uostream::uostream(const char* name, int m, int prot)
00028 :ofstream(name, std::ios::binary | std::ios::openmode(m))
00029 {
00030 }
00031
00036 void uistream::open(const char* name, int m, int prot)
00037 {
00038 ifstream::open(name, std::ios::binary | std::ios::openmode(m));
00039 }
00040
00045 void uostream::open(const char* name, int m, int prot)
00046 {
00047 ofstream::open(name, std::ios::binary | std::ios::openmode(m));
00048 }
00049
00054 uistream::uistream(const char* name, int m, int prot)
00055 :ifstream(name, std::ios::binary | std::ios::openmode(m))
00056 {
00057 }
00058
00059 uistream& uistream::operator>>(int& x)
00060 {
00061 read((char*)&x, sizeof(int));
00062 return *this;
00063 }
00064
00065 #ifdef __ZTC__
00066 uostream::uostream(const char* name, int m, int prot)
00067 :ios(&buffer), ofstream(name, m, prot) { }
00068
00069 uistream::uistream(const char* name, int m, int prot)
00070 :ios(&buffer), ifstream(name, m| ios::nocreate , prot) { }
00071 #endif
00072
00073
00074 #ifndef __SUN__
00075 INSERT_IMPLEMENT(signed char)
00076 #endif
00077 INSERT_IMPLEMENT(unsigned char)
00078 INSERT_IMPLEMENT(short)
00079 INSERT_IMPLEMENT(int)
00080 INSERT_IMPLEMENT(long)
00081 INSERT_IMPLEMENT(unsigned short)
00082 INSERT_IMPLEMENT(unsigned long)
00083 INSERT_IMPLEMENT(float)
00084 INSERT_IMPLEMENT(double)
00085
00086 #ifdef __TURBOC__
00087 INSERT_IMPLEMENT(long double)
00088 #endif
00089
00090
00091 #ifndef __SUN__
00092
00093 EXTRACT_IMPLEMENT(signed char)
00094 EXTRACT_IMPLEMENT(unsigned char)
00095 EXTRACT_IMPLEMENT(char)
00096 EXTRACT_IMPLEMENT(short)
00097 EXTRACT_IMPLEMENT(int)
00098 EXTRACT_IMPLEMENT(long)
00099 EXTRACT_IMPLEMENT(unsigned short)
00100 EXTRACT_IMPLEMENT(unsigned long)
00101 EXTRACT_IMPLEMENT(float)
00102 EXTRACT_IMPLEMENT(double)
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 #endif
00116
00117 #ifdef __TURBOC__
00118 # if (__BORLANDC__ > 0x0520)
00119 EXTRACT_IMPLEMENT(long double)
00120 # else
00121 EXTRACT_IMPLEMENT(const long double)
00122 #endif
00123 #endif
00124