DEADSOFTWARE

Fold toString()
[odcread.git] / fold.cc
1 #include <fold.h>
2 #include <reader.h>
4 namespace odc {
6 const std::string View::TYPENAME("Views.View^");
7 const TypeProxy<View> View::PROXY;
9 View::View(INTEGER id) : Store(id) {}
11 const std::string &View::getType() {
12 return TYPENAME;
13 }
15 const std::string *View::getSuper() {
16 return &Store::getType();
17 }
19 const std::string &View::getTypeName() const {
20 return getType();
21 }
23 void View::internalize(Reader &reader) {
24 Store::internalize(reader);
25 if (reader.isCancelled()) return;
26 reader.readVersion(0, 0);
27 }
29 const std::string Fold::TYPENAME("StdFolds.Fold^");
30 const TypeProxy<Fold> Fold::PROXY;
32 Fold::Fold(INTEGER id) : View(id) {}
34 const std::string &Fold::getType() {
35 return TYPENAME;
36 }
38 const std::string *Fold::getSuper() {
39 return &View::getType();
40 }
42 const std::string &Fold::getTypeName() const {
43 return getType();
44 }
46 void Fold::internalize(Reader &reader) {
47 View::internalize(reader);
48 if (reader.isCancelled()) return;
49 reader.readVersion(0, 0);
50 if (reader.isCancelled()) return;
51 // rd.ReadXInt(xint);fold.leftSide := xint = 0;
52 reader.readSInt();
53 // rd.ReadXInt(xint); fold.collapsed := xint = 0;
54 reader.readSInt();
55 // rd.ReadXString(fold.label);
56 d_label = new SHORTCHAR[32];
57 reader.readSString(d_label); // the label
58 // rd.ReadStore(store);
59 d_hidden = reader.readStore(); // the hidden part
60 // IF store # NIL THEN fold.hidden := store(TextModels.Model); Stores.Join(fold.hidden, fold)
61 // ELSE fold.hidden := NIL
62 // END;
63 // fold.leftSide := store # NIL
64 }
66 std::string Fold::toString() {
67 if (d_hidden == 0) {
68 return std::string("Fold(right)");
69 }
70 return std::string("Fold(left)") + std::string(" { ") + d_hidden->toString() + std::string(" }");
71 }
73 } // namespace odc