summaryrefslogtreecommitdiff
path: root/src/serializerbinary.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-11-25 23:38:14 +0000
committerMike Buland <eichlan@xagasoft.com>2006-11-25 23:38:14 +0000
commit27e0164234c916adaf0ce78e29dffe565302ef53 (patch)
tree9153d33a0fcd67c38daba80a4f6c406a8701cec4 /src/serializerbinary.cpp
parent2828a0bb77e2cf1bc6fbd38c3bca5cfaddb23b80 (diff)
downloadlibbu++-27e0164234c916adaf0ce78e29dffe565302ef53.tar.gz
libbu++-27e0164234c916adaf0ce78e29dffe565302ef53.tar.bz2
libbu++-27e0164234c916adaf0ce78e29dffe565302ef53.tar.xz
libbu++-27e0164234c916adaf0ce78e29dffe565302ef53.zip
I think this is a better serializer model.
Diffstat (limited to 'src/serializerbinary.cpp')
-rw-r--r--src/serializerbinary.cpp126
1 files changed, 4 insertions, 122 deletions
diff --git a/src/serializerbinary.cpp b/src/serializerbinary.cpp
index 23fb2b1..bfe3cc9 100644
--- a/src/serializerbinary.cpp
+++ b/src/serializerbinary.cpp
@@ -48,127 +48,9 @@ void SerializerBinary::write(const void * pData, int32_t nSize)
48 48
49void SerializerBinary::read(void * pData, int32_t nSize) 49void SerializerBinary::read(void * pData, int32_t nSize)
50{ 50{
51 fread(pData, nSize, 1, fhFile); 51 if( fread(pData, nSize, 1, fhFile) < 1 )
52} 52 {
53 53 throw FileException( excodeEOF, "End of file read");
54Serializer &SerializerBinary::operator<<(bool p) 54 }
55{
56 fwrite(&p, sizeof(p), 1, fhFile);
57 return *this;
58}
59Serializer &SerializerBinary::operator<<(int8_t p)
60{
61 fwrite(&p, sizeof(p), 1, fhFile);
62 return *this;
63}
64Serializer &SerializerBinary::operator<<(int16_t p)
65{
66 fwrite(&p, sizeof(p), 1, fhFile);
67 return *this;
68}
69Serializer &SerializerBinary::operator<<(int32_t p)
70{
71 fwrite(&p, sizeof(p), 1, fhFile);
72 return *this;
73}
74Serializer &SerializerBinary::operator<<(int64_t p)
75{
76 fwrite(&p, sizeof(p), 1, fhFile);
77 return *this;
78}
79Serializer &SerializerBinary::operator<<(uint8_t p)
80{
81 fwrite(&p, sizeof(p), 1, fhFile);
82 return *this;
83}
84Serializer &SerializerBinary::operator<<(uint16_t p)
85{
86 fwrite(&p, sizeof(p), 1, fhFile);
87 return *this;
88}
89Serializer &SerializerBinary::operator<<(uint32_t p)
90{
91 fwrite(&p, sizeof(p), 1, fhFile);
92 return *this;
93}
94Serializer &SerializerBinary::operator<<(uint64_t p)
95{
96 fwrite(&p, sizeof(p), 1, fhFile);
97 return *this;
98}
99Serializer &SerializerBinary::operator<<(float p)
100{
101 fwrite(&p, sizeof(p), 1, fhFile);
102 return *this;
103}
104Serializer &SerializerBinary::operator<<(double p)
105{
106 fwrite(&p, sizeof(p), 1, fhFile);
107 return *this;
108}
109Serializer &SerializerBinary::operator<<(long double p)
110{
111 fwrite(&p, sizeof(p), 1, fhFile);
112 return *this;
113} 55}
114 56
115Serializer &SerializerBinary::operator>>(bool &p)
116{
117 fread(&p, sizeof(p), 1, fhFile);
118 return *this;
119}
120Serializer &SerializerBinary::operator>>(int8_t &p)
121{
122 fread(&p, sizeof(p), 1, fhFile);
123 return *this;
124}
125Serializer &SerializerBinary::operator>>(int16_t &p)
126{
127 fread(&p, sizeof(p), 1, fhFile);
128 return *this;
129}
130Serializer &SerializerBinary::operator>>(int32_t &p)
131{
132 fread(&p, sizeof(p), 1, fhFile);
133 return *this;
134}
135Serializer &SerializerBinary::operator>>(int64_t &p)
136{
137 fread(&p, sizeof(p), 1, fhFile);
138 return *this;
139}
140Serializer &SerializerBinary::operator>>(uint8_t &p)
141{
142 fread(&p, sizeof(p), 1, fhFile);
143 return *this;
144}
145Serializer &SerializerBinary::operator>>(uint16_t &p)
146{
147 fread(&p, sizeof(p), 1, fhFile);
148 return *this;
149}
150Serializer &SerializerBinary::operator>>(uint32_t &p)
151{
152 fread(&p, sizeof(p), 1, fhFile);
153 return *this;
154}
155Serializer &SerializerBinary::operator>>(uint64_t &p)
156{
157 fread(&p, sizeof(p), 1, fhFile);
158 return *this;
159}
160Serializer &SerializerBinary::operator>>(float &p)
161{
162 fread(&p, sizeof(p), 1, fhFile);
163 return *this;
164}
165Serializer &SerializerBinary::operator>>(double &p)
166{
167 fread(&p, sizeof(p), 1, fhFile);
168 return *this;
169}
170Serializer &SerializerBinary::operator>>(long double &p)
171{
172 fread(&p, sizeof(p), 1, fhFile);
173 return *this;
174}