DEADSOFTWARE

Disable debug output, read TextPieces into memory
[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 private:
33 CHAR *d_buf;
34 public:
35 LongPiece(size_t len);
36 ~LongPiece();
37 virtual void read(Reader &reader);
38 virtual std::string toString();
39 };
41 class ShortPiece : public TextPiece {
42 private:
43 SHORTCHAR *d_buf;
44 public:
45 ShortPiece(size_t len);
46 ~ShortPiece();
47 virtual void read(Reader &reader);
48 virtual std::string toString();
49 };
51 class ViewPiece : public TextPiece {
52 Store *d_view;
53 public:
54 ViewPiece(Store *view);
55 virtual void read(Reader &reader);
56 virtual std::string toString();
57 };
59 class StdTextModel : public TextModel {
60 private:
61 static const std::string TYPENAME;
62 static const TypeProxy<StdTextModel> PROXY;
63 std::vector<TextPiece *> d_pieces;
65 public:
66 StdTextModel(INTEGER id);
67 static const std::string &getType();
68 static const std::string *getSuper();
69 virtual const std::string &getTypeName() const;
70 virtual void internalize(Reader &reader);
72 virtual std::string toString();
73 };
75 } // namespace odc
77 #endif // _TEXTMODEL_H_