-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerializer.h
More file actions
41 lines (36 loc) · 1004 Bytes
/
Serializer.h
File metadata and controls
41 lines (36 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
GPL v3
*/
#pragma once
#include <string>
#include <iostream>
class Serializer
{
public:
Serializer();
~Serializer();
Serializer &operator <<(const bool &b) ;
Serializer &operator <<(const int &b) ;
Serializer &operator <<(const long &b) ;
Serializer &operator <<(const double &b) ;
Serializer &operator <<(const std::string & b) ;
Serializer &operator >>( bool &b) ;
Serializer &operator >>( int &b) ;
Serializer &operator >>( long &b) ;
Serializer &operator >>( double &b) ;
Serializer &operator >>( std::string & b) ;
void saveFile (std::string);
void readFile (std::string);
friend std::istream& operator>> (std::istream& out, Serializer& per);
friend std::ostream& operator<< (std::ostream& out, Serializer& per);
private :
unsigned char INT_TYPE;
unsigned char LONG_TYPE;
unsigned char STRING_TYPE;
unsigned char DOUBLE_TYPE;
unsigned char *data_;
size_t size_;
void addEnd( unsigned char &);
unsigned char readBegin();
unsigned char verifyBegin();
};