94ed5878f6f00a1831f2f3b671f3285118ac925d
1 #include "fold/fold.ih"
5 const std::string
View::TYPENAME("Views.View^");
6 const TypeProxy
<View
, Store
> View::PROXY
;
8 View::View(INTEGER id
) : Store(id
) {}
10 const std::string
&View::getTypeName() const {
14 void View::internalize(Reader
&reader
) {
15 Store::internalize(reader
);
16 if (reader
.isCancelled()) return;
17 reader
.readVersion(0, 0);
20 const std::string
Fold::TYPENAME("StdFolds.Fold^");
21 const TypeProxy
<Fold
, View
> Fold::PROXY
;
23 Fold::Fold(INTEGER id
) : View(id
) {}
25 const std::string
&Fold::getTypeName() const {
29 void Fold::internalize(Reader
&reader
) {
30 View::internalize(reader
);
31 if (reader
.isCancelled()) return;
32 reader
.readVersion(0, 0);
33 if (reader
.isCancelled()) return;
34 // rd.ReadXInt(xint);fold.leftSide := xint = 0;
36 // rd.ReadXInt(xint); fold.collapsed := xint = 0;
37 SHORTINT c
= reader
.readSInt();
38 d_collapsed
= (c
== 0);
39 // rd.ReadXString(fold.label);
40 d_label
= new SHORTCHAR
[32];
41 reader
.readSString(d_label
); // the label
42 // rd.ReadStore(store);
43 d_hidden
= reader
.readStore(); // the hidden part
44 // IF store # NIL THEN fold.hidden := store(TextModels.Model); Stores.Join(fold.hidden, fold)
45 // ELSE fold.hidden := NIL
47 // fold.leftSide := store # NIL
50 std::string
Fold::toString() {
52 return std::string("Fold(right)");
54 return std::string("Fold(left) \"") + std::string(d_label
) + std::string("\" { ") + d_hidden
->toString() + std::string(" }");
57 void Fold::accept(Visitor
&visitor
) const {
58 if (d_hidden
== 0) { // right part
61 visitor
.foldLeft(d_collapsed
);
62 d_hidden
->accept(visitor
);