diff options
Diffstat (limited to 'ext/wittle_generator/Serializer.h')
-rw-r--r-- | ext/wittle_generator/Serializer.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/ext/wittle_generator/Serializer.h b/ext/wittle_generator/Serializer.h new file mode 100644 index 0000000..86b262d --- /dev/null +++ b/ext/wittle_generator/Serializer.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef SERIALIZER_H_51D08D41 | ||
2 | #define SERIALIZER_H_51D08D41 | ||
3 | |||
4 | #include <string> | ||
5 | |||
6 | constexpr int SERIALIZER_VERSION = 0; | ||
7 | |||
8 | class Serializer { | ||
9 | public: | ||
10 | enum CellType : char { | ||
11 | Null = 0, | ||
12 | Line = 1, | ||
13 | Square = 2, | ||
14 | Star = 3, | ||
15 | Nega = 4, | ||
16 | Triangle = 5, | ||
17 | Poly = 6, | ||
18 | Ylop = 7, | ||
19 | Nonce = 8 | ||
20 | }; | ||
21 | |||
22 | enum CellPart : char { | ||
23 | Start = 1, | ||
24 | EndLeft = 2, | ||
25 | EndRight = 4, | ||
26 | EndTop = 8, | ||
27 | EndBottom = 16 | ||
28 | }; | ||
29 | |||
30 | enum GenericFlag : char { | ||
31 | Autosolved = 1, | ||
32 | Symmetrical = 2, | ||
33 | SymmetryX = 4, | ||
34 | SymmetryY = 8, | ||
35 | Pillar = 16 | ||
36 | }; | ||
37 | |||
38 | enum LineColor : char { | ||
39 | LineNone = 0, | ||
40 | LineBlack = 1, | ||
41 | LineBlue = 2, | ||
42 | LineYellow = 3 | ||
43 | }; | ||
44 | |||
45 | enum DotColor : char { | ||
46 | DotNone = 0, | ||
47 | DotBlack = 1, | ||
48 | DotBlue = 2, | ||
49 | DotYellow = 3, | ||
50 | DotInvisible = 4 | ||
51 | }; | ||
52 | |||
53 | enum SettingsFlag : char { | ||
54 | NegationsCancelNegations = 1, | ||
55 | ShapelessZeroPoly = 2, | ||
56 | PrecisePolyominos = 4, | ||
57 | FlashForErrors = 8, | ||
58 | FatStartpoints = 16, | ||
59 | CustomMechanics = 32 | ||
60 | }; | ||
61 | |||
62 | enum GapType : char { GapNone = 0, GapBreak = 1, GapFull = 2 }; | ||
63 | |||
64 | void writeByte(char val); | ||
65 | void writeInt(int val); | ||
66 | void writeLong(long val); | ||
67 | void writeColor(int val); | ||
68 | void writeString(const std::string& val); | ||
69 | |||
70 | std::string str() const; | ||
71 | |||
72 | private: | ||
73 | std::string buffer_; | ||
74 | }; | ||
75 | |||
76 | #endif /* end of include guard: SERIALIZER_H_51D08D41 */ | ||