DEADSOFTWARE

Add some error handling, close to understanding StdTextModel
[odcread.git] / reader.h
index e9b0234b4972c403099584334386b9d7cb137b62..b4f475ca725bceff119d4f2bd790171995d4bd56 100644 (file)
--- a/reader.h
+++ b/reader.h
@@ -25,6 +25,9 @@ struct TypeEntry {
  */ 
 class Reader {
 private:
+       static const unsigned int TYPENOTFOUND = 1;
+       static const unsigned int ALIENVERSION = 2;
+
        /*
         * rider-: Files.Reader
         * The file rider which links a Reader to a file.
@@ -33,7 +36,7 @@ private:
 
        /*
         * cancelled-: BOOLEAN  valid during a Store.Internalize call
-        * Tells whether the currently executing Internalize has been called by ReadVersion or TurnIntoAlien.
+        * Tells whether the currently executing Internalize has been cancelled by ReadVersion or TurnIntoAlien.
         */
        bool d_cancelled;
 
@@ -43,6 +46,11 @@ private:
         */
        bool d_readAlien;
 
+       /**
+        * Cause of current read being alien.
+        */
+       unsigned int d_cause;
+
        std::vector<TypeEntry*> d_typeList;
 
        std::vector<Store*> d_elemList; // FIXME: WTH, why are these different?
@@ -62,8 +70,6 @@ private:
        };
        ReaderState *d_state;
 
-       INTEGER d_cause;
-
        public:
        /**
         * Construct a reader from the istream rider.
@@ -257,6 +263,9 @@ private:
         * Pre
         * 20   cause > 0
         */
+       void turnIntoAlien(int cause);
+
+       bool isCancelled();
 
        private:
        Store *readStoreOrElemStore(bool isElem);