DEADSOFTWARE

Read NIL stores correctly
[odcread.git] / textmodel.h
1 #ifndef _TEXTMODEL_H_
2 #define _TEXTMODEL_H_
4 #include <oberon.h>
5 #include <typeregister.h>
6 #include <store.h>
8 namespace odc {
10 class TextModel : public ContainerModel {
11 private:
12 static const std::string TYPENAME;
13 static const TypeProxy<TextModel> PROXY;
15 public:
16 TextModel(INTEGER id);
17 static const std::string &getType();
18 static const std::string *getSuper();
19 virtual const std::string &getTypeName() const;
20 virtual void internalize(Reader &reader);
21 };
23 class TextPiece {
24 public:
25 const size_t d_len;
26 TextPiece(size_t len);
27 virtual void read(Reader &reader) = 0;
28 virtual std::string toString() = 0;
29 };
31 class LongPiece : public TextPiece {
32 public:
33 LongPiece(size_t len);
34 virtual void read(Reader &reader);
35 virtual std::string toString();
36 };
38 class ShortPiece : public TextPiece {
39 public:
40 ShortPiece(size_t len);
41 virtual void read(Reader &reader);
42 virtual std::string toString();
43 };
45 class ViewPiece : public TextPiece {
46 Store *d_view;
47 public:
48 ViewPiece(Store *view);
49 virtual void read(Reader &reader);
50 virtual std::string toString();
51 };
53 class StdTextModel : public TextModel {
54 private:
55 static const std::string TYPENAME;
56 static const TypeProxy<StdTextModel> PROXY;
57 std::vector<TextPiece *> d_pieces;
59 public:
60 StdTextModel(INTEGER id);
61 static const std::string &getType();
62 static const std::string *getSuper();
63 virtual const std::string &getTypeName() const;
64 virtual void internalize(Reader &reader);
66 virtual std::string toString();
67 };
69 } // namespace odc
71 #endif // _TEXTMODEL_H_