X-Git-Url: https://deadsoftware.ru/gitweb?p=odcread.git;a=blobdiff_plain;f=alien.cc;h=dc4f50920c7d61d30bec5744a7bba9e8ccacd018;hp=7a225b71932e33b20e570e04de81712f12849623;hb=41d9c65ec79728a8771cd2288dfc3458569c6801;hpb=121a58d72f3b5e537007072f93397f6e6661fb90 diff --git a/alien.cc b/alien.cc index 7a225b7..dc4f509 100644 --- a/alien.cc +++ b/alien.cc @@ -8,24 +8,42 @@ std::string AlienPiece::toString() { return std::string("AlienPiece"); } -AlienPart::AlienPart(Store * const _store): store(_store) {} +void AlienPiece::accept(Visitor &visitor) const { +} + +AlienPart::AlienPart(Store * const store): d_store(store) {} std::string AlienPart::toString() { - return store->toString(); + if (d_store != 0) + return d_store->toString(); + else + return "NULL"; +} + +void AlienPart::accept(Visitor &visitor) const { + if (d_store != 0) { + d_store->accept(visitor); + } } -Alien::Alien(INTEGER id, SHORTCHAR **path): Store(id), d_path(path), d_comps() {} +Alien::Alien(INTEGER id, const TypePath &path): Store(id), d_path(path), d_comps() {} std::vector & Alien::getComponents() { return d_comps; } std::string Alien::toString() { - std::string sofar = std::string(d_path[0]) + "{ "; + std::string sofar = d_path.toString() + "{ "; for (int i = 0; i < d_comps.size(); ++i) { sofar += d_comps[i]->toString() + " "; } return sofar + "}"; } +void Alien::accept(Visitor &visitor) const { + for (int i = 0; i < d_comps.size(); ++i) { + d_comps[i]->accept(visitor); + } +} + }