X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=alien.h;h=77db1febc2239e3d12886ff7ee8e44e2a8edc90f;hb=75b3c194e9b084d81f69759d7de71d60f3fde3e1;hp=7447f953cc9ec3e4ee9b987853cb4b94f1629d9f;hpb=cf035fa1849a5e65c0d636ce2718bc2c85994680;p=odcread.git diff --git a/alien.h b/alien.h index 7447f95..77db1fe 100644 --- a/alien.h +++ b/alien.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -14,7 +15,7 @@ namespace odc { */ struct AlienComponent { virtual std::string toString() = 0; - virtual std::string toPlainText() = 0; + virtual void accept(Visitor &visitor) const = 0; }; /** @@ -27,7 +28,7 @@ struct AlienPiece : public AlienComponent { AlienPiece(const char * const data, const size_t len); virtual std::string toString(); - virtual std::string toPlainText(); + virtual void accept(Visitor &visitor) const; }; /** @@ -39,9 +40,14 @@ struct AlienPart : public AlienComponent { AlienPart(Store * const store); virtual std::string toString(); - virtual std::string toPlainText(); + virtual void accept(Visitor &visitor) const; }; +/** + * Any type that's not registered is treated as an "Alien". + * This allows us to read files even if they contain things we're not aware of. + * The alien will consist of AlienComponents, some of which we may be able to read. + */ class Alien : public Store { const TypePath d_path; std::vector d_comps; @@ -57,7 +63,7 @@ class Alien : public Store { // comps-: AlienComp (** the constituent components of this alien store **) virtual std::string toString(); - virtual std::string toPlainText(); + virtual void accept(Visitor &visitor) const; }; }