DEADSOFTWARE

Fold toString()
authorGert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl>
Mon, 7 Nov 2011 22:42:04 +0000 (22:42 +0000)
committerGert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl>
Mon, 7 Nov 2011 22:42:04 +0000 (22:42 +0000)
fold.cc
fold.h

diff --git a/fold.cc b/fold.cc
index 5cdbbb46ec12e89c40c4d1be530c937f5505e7e8..b416401ede108ab39c71e3c7ab11c64de0560a00 100644 (file)
--- a/fold.cc
+++ b/fold.cc
@@ -53,14 +53,21 @@ void Fold::internalize(Reader &reader) {
 //             rd.ReadXInt(xint); fold.collapsed := xint = 0;
        reader.readSInt();
 //             rd.ReadXString(fold.label);
-       SHORTCHAR label[32];
-       reader.readSString(label); // the label
+       d_label = new SHORTCHAR[32];
+       reader.readSString(d_label); // the label
 //             rd.ReadStore(store);
-       reader.readStore(); // the hidden part
+       d_hidden = reader.readStore(); // the hidden part
 //             IF store # NIL THEN fold.hidden := store(TextModels.Model); Stores.Join(fold.hidden, fold)
 //             ELSE fold.hidden := NIL
 //             END;
 //             fold.leftSide := store # NIL
 }
 
+std::string Fold::toString() {
+       if (d_hidden == 0) {
+               return std::string("Fold(right)");
+       }
+       return std::string("Fold(left)") + std::string(" { ") + d_hidden->toString() + std::string("  }");
+}
+
 } // namespace odc
diff --git a/fold.h b/fold.h
index ad566426064087187b09af61640a33f812b72d5a..78eaa4e004aafb20da4f18afaa96796374b20b86 100644 (file)
--- a/fold.h
+++ b/fold.h
@@ -25,12 +25,17 @@ namespace odc {
                static const std::string TYPENAME;
                static const TypeProxy<Fold> PROXY;
 
+               Store *d_hidden;
+               SHORTCHAR *d_label;
+
                public:
                Fold(INTEGER id);
                static const std::string &getType();
                static const std::string *getSuper();
                virtual const std::string &getTypeName() const;
                virtual void internalize(Reader &reader);
+
+               virtual std::string toString();
        };
 
 }