diff options
Diffstat (limited to '')
-rw-r--r-- | src/serializer.h | 3 | ||||
-rw-r--r-- | src/serializerbinary.cpp | 10 | ||||
-rw-r--r-- | src/serializerbinary.h | 3 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/serializer.h b/src/serializer.h index 03e6820..f2648e3 100644 --- a/src/serializer.h +++ b/src/serializer.h | |||
@@ -15,6 +15,9 @@ public: | |||
15 | virtual ~Serializer(); | 15 | virtual ~Serializer(); |
16 | virtual void close()=0; | 16 | virtual void close()=0; |
17 | 17 | ||
18 | virtual void write(void *, int32_t)=0; | ||
19 | virtual void read(void *, int32_t)=0; | ||
20 | |||
18 | virtual Serializer &operator<<(bool)=0; | 21 | virtual Serializer &operator<<(bool)=0; |
19 | virtual Serializer &operator<<(int8_t)=0; | 22 | virtual Serializer &operator<<(int8_t)=0; |
20 | virtual Serializer &operator<<(int16_t)=0; | 23 | virtual Serializer &operator<<(int16_t)=0; |
diff --git a/src/serializerbinary.cpp b/src/serializerbinary.cpp index 1ea9f36..53e469f 100644 --- a/src/serializerbinary.cpp +++ b/src/serializerbinary.cpp | |||
@@ -35,6 +35,16 @@ void SerializerBinary::close() | |||
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | void SerializerBinary::write(void * pData, int32_t nSize) | ||
39 | { | ||
40 | fwrite(pData, nSize, 1, fhFile); | ||
41 | } | ||
42 | |||
43 | void SerializerBinary::read(void * pData, int32_t nSize) | ||
44 | { | ||
45 | fread(pData, nSize, 1, fhFile); | ||
46 | } | ||
47 | |||
38 | Serializer &SerializerBinary::operator<<(bool p) | 48 | Serializer &SerializerBinary::operator<<(bool p) |
39 | { | 49 | { |
40 | fwrite(&p, sizeof(p), 1, fhFile); | 50 | fwrite(&p, sizeof(p), 1, fhFile); |
diff --git a/src/serializerbinary.h b/src/serializerbinary.h index 4a2f301..7323d3b 100644 --- a/src/serializerbinary.h +++ b/src/serializerbinary.h | |||
@@ -13,6 +13,9 @@ public: | |||
13 | 13 | ||
14 | virtual void close(); | 14 | virtual void close(); |
15 | 15 | ||
16 | virtual void write(void *, int32_t); | ||
17 | virtual void read(void *, int32_t); | ||
18 | |||
16 | virtual Serializer &operator<<(bool); | 19 | virtual Serializer &operator<<(bool); |
17 | virtual Serializer &operator<<(int8_t); | 20 | virtual Serializer &operator<<(int8_t); |
18 | virtual Serializer &operator<<(int16_t); | 21 | virtual Serializer &operator<<(int16_t); |