DEADSOFTWARE

Testing odcread against a bunch of existing .odc files
[odcread.git] / odcread.cc
index 24bb51ea68a0fa9e8706ac8a42aa11b94871c6fb..858028e6babf5e252ede8ade0c0f71d2946ceb4e 100644 (file)
@@ -85,8 +85,9 @@ namespace odc {
                        d_context.top()->addPiece(text);
                }
                virtual void textLongPiece(const LongPiece *piece) {
-                       std::string text = piece->getText();
-                       d_context.top()->addPiece(text);
+                       throw "Long Piece not handled";
+                       //std::string text = piece->getText();
+                       //d_context.top()->addPiece(text);
                }
        };
 
@@ -112,12 +113,27 @@ int main(int argc, char *argv[]) {
                return 1;
        }
        std::ifstream in(argv[1], std::ios::in | std::ios::binary);
-       odc::Store* s = odc::importDocument(in);
+
+       odc::Store* s;
+       try {
+               s = odc::importDocument(in);
+       } catch (int trap) {
+               std::cerr << "Exception in parsing file: BlackBox trap no. " << trap << std::endl;
+               return 2;
+       } catch (const char * exception) {
+               std::cerr << "Exception in parsing file: " << exception << std::endl;
+               return 2;
+       }
 //     std::cout << s->toPlainText() << std::endl;
 //     std::cout << std::endl << std::endl;
 
-       odc::MyVisitor visitor;
-       s->accept(visitor);
+       try {
+               odc::MyVisitor visitor;
+               s->accept(visitor);
+       } catch (const char * exception) {
+               std::cerr << "Exception in processing document: " << exception << std::endl;
+               return 3;
+       }
 //     std::cout << s->toString() << std::endl;
 //     std::cout << in.tellg() << " " << in.eof() << std::endl;