DEADSOFTWARE

Almost-correct toPlainText
[odcread.git] / alien.cc
index 49d19fe5c9b06829bdc8deac3a688890da957b78..fddd2024dbcb0dfd2ee200c52b3b93170f8c6a54 100644 (file)
--- a/alien.cc
+++ b/alien.cc
@@ -8,15 +8,26 @@ std::string AlienPiece::toString() {
        return std::string("AlienPiece");
 }
 
-AlienPart::AlienPart(Store * const _store): store(_store) {}
+std::string AlienPiece::toPlainText() {
+       return std::string();
+}
+
+AlienPart::AlienPart(Store * const store): d_store(store) {}
 
 std::string AlienPart::toString() {
-       if (store != 0)
-               return store->toString();
+       if (d_store != 0)
+               return d_store->toString();
        else
                return "NULL";
 }
 
+std::string AlienPart::toPlainText() {
+       if (d_store != 0)
+               return d_store->toPlainText();
+       else
+               return std::string();
+}
+
 Alien::Alien(INTEGER id, const TypePath &path): Store(id), d_path(path), d_comps() {}
 
 std::vector<AlienComponent*> & Alien::getComponents() {
@@ -31,4 +42,12 @@ std::string Alien::toString() {
        return sofar + "}";
 }
 
+std::string Alien::toPlainText() {
+       std::string sofar = std::string();
+       for (int i = 0; i < d_comps.size(); ++i) {
+               sofar += d_comps[i]->toPlainText();
+       }
+       return sofar;
+}
+
 }