DEADSOFTWARE

Testing odcread against a bunch of existing .odc files
[odcread.git] / alien.h
1 #ifndef _ALIEN_H_
2 #define _ALIEN_H_
4 #include <oberon.h>
5 #include <store.h>
6 #include <visitor.h>
7 #include <iostream>
8 #include <vector>
9 #include <string>
11 namespace odc {
13 /**
14 * Part of an alien store
15 */
16 struct AlienComponent {
17 virtual std::string toString() = 0;
18 virtual void accept(Visitor &visitor) const = 0;
19 };
21 /**
22 * Totally unstructured part of an alien store
23 */
24 struct AlienPiece : public AlienComponent {
25 const char * const data;
26 const size_t len;
28 AlienPiece(const char * const data, const size_t len);
30 virtual std::string toString();
31 virtual void accept(Visitor &visitor) const;
32 };
34 /**
35 * Store component of an alien store
36 */
37 struct AlienPart : public AlienComponent {
38 Store * const d_store;
40 AlienPart(Store * const store);
42 virtual std::string toString();
43 virtual void accept(Visitor &visitor) const;
44 };
46 /**
47 * Any type that's not registered is treated as an "Alien".
48 * This allows us to read files even if they contain things we're not aware of.
49 * The alien will consist of AlienComponents, some of which we may be able to read.
50 */
51 class Alien : public Store {
52 const TypePath d_path;
53 std::vector<AlienComponent*> d_comps;
55 public:
57 Alien(INTEGER id, const TypePath &path);
59 std::vector<AlienComponent*> & getComponents();
61 // cause-: INTEGER; (** # 0, the cause that turned this store into an alien **)
62 // file-: Files.File; (** base file holding alien pieces **)
63 // comps-: AlienComp (** the constituent components of this alien store **)
65 virtual std::string toString();
66 virtual void accept(Visitor &visitor) const;
67 };
69 }
70 #endif // _ALIEN_H_