about summary refs log tree commit diff stats
path: root/ext/wittle_generator/Serializer.h
blob: 86b262dbbbec578ae0ad7380ccd7b8e419144af9 (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef SERIALIZER_H_51D08D41
#define SERIALIZER_H_51D08D41

#include <string>

constexpr int SERIALIZER_VERSION = 0;

class Serializer {
 public:
  enum CellType : char {
    Null = 0,
    Line = 1,
    Square = 2,
    Star = 3,
    Nega = 4,
    Triangle = 5,
    Poly = 6,
    Ylop = 7,
    Nonce = 8
  };

  enum CellPart : char {
    Start = 1,
    EndLeft = 2,
    EndRight = 4,
    EndTop = 8,
    EndBottom = 16
  };

  enum GenericFlag : char {
    Autosolved = 1,
    Symmetrical = 2,
    SymmetryX = 4,
    SymmetryY = 8,
    Pillar = 16
  };

  enum LineColor : char {
    LineNone = 0,
    LineBlack = 1,
    LineBlue = 2,
    LineYellow = 3
  };

  enum DotColor : char {
    DotNone = 0,
    DotBlack = 1,
    DotBlue = 2,
    DotYellow = 3,
    DotInvisible = 4
  };

  enum SettingsFlag : char {
    NegationsCancelNegations = 1,
    ShapelessZeroPoly = 2,
    PrecisePolyominos = 4,
    FlashForErrors = 8,
    FatStartpoints = 16,
    CustomMechanics = 32
  };

  enum GapType : char { GapNone = 0, GapBreak = 1, GapFull = 2 };

  void writeByte(char val);
  void writeInt(int val);
  void writeLong(long val);
  void writeColor(int val);
  void writeString(const std::string& val);

  std::string str() const;

 private:
  std::string buffer_;
};

#endif /* end of include guard: SERIALIZER_H_51D08D41 */