X-Git-Url: https://deadsoftware.ru/gitweb?p=odcread.git;a=blobdiff_plain;f=fold%2Ffold.cc;h=62421f322bc5054f9094630d794ac00990e4b9cf;hp=9a0195f941ea010f7d9eb40c78beaeaf9909eaec;hb=985a0a951617a4a82935bc23590c4b3c0c3679c0;hpb=68f5d585dbbada3c3c69ac2cd9ba8e6d2ef3adae diff --git a/fold/fold.cc b/fold/fold.cc index 9a0195f..62421f3 100644 --- a/fold/fold.cc +++ b/fold/fold.cc @@ -2,65 +2,20 @@ namespace odc { -const std::string View::TYPENAME("Views.View^"); -const TypeProxy View::PROXY; - -View::View(INTEGER id) : Store(id) {} - -const std::string &View::getTypeName() const { - return TYPENAME; -} - -void View::internalize(Reader &reader) { - Store::internalize(reader); - if (reader.isCancelled()) return; - reader.readVersion(0, 0); -} - const std::string Fold::TYPENAME("StdFolds.Fold^"); const TypeProxy Fold::PROXY; Fold::Fold(INTEGER id) : View(id) {} -const std::string &Fold::getTypeName() const { - return TYPENAME; -} - -void Fold::internalize(Reader &reader) { - View::internalize(reader); - if (reader.isCancelled()) return; - reader.readVersion(0, 0); - if (reader.isCancelled()) return; -// rd.ReadXInt(xint);fold.leftSide := xint = 0; - reader.readSInt(); -// rd.ReadXInt(xint); fold.collapsed := xint = 0; - SHORTINT c = reader.readSInt(); - d_collapsed = (c == 0); -// rd.ReadXString(fold.label); - d_label = new SHORTCHAR[32]; - reader.readSString(d_label); // the label -// rd.ReadStore(store); - 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)"); +Fold::~Fold() { + if (d_hidden != 0) { + delete d_hidden; } - return std::string("Fold(left) \"") + std::string(d_label) + std::string("\" { ") + d_hidden->toString() + std::string(" }"); + delete d_label; } -void Fold::accept(Visitor &visitor) const { - if (d_hidden == 0) { // right part - visitor.foldRight(); - } else { // left part - visitor.foldLeft(d_collapsed); - d_hidden->accept(visitor); - } +const std::string &Fold::getTypeName() const { + return TYPENAME; } } // namespace odc