Main Page | Class Hierarchy | Compound List | File List | Compound Members

BxBinxParser.h

00001 // ##################################################################
00002 // Binx
00003 // $Id: BxBinxParser_8h-source.html,v 1.1.1.1 2006/04/19 14:19:02 edikt2 Exp $
00004 //
00005 // Header for BxBinxParser
00006 // ##################################################################
00007 /*
00008 
00009 //  edikt::BinX
00010 //  www.edikt.org
00011 //  support@edikt.org
00012 
00013 // Copyright (c) 2004 The University of Edinburgh.
00014 
00015 */
00016 
00017 #ifndef __BxBinxParser__
00018 #define __BxBinxParser__
00019 
00020 #include "BxDataset.h"
00021 #include "BxBinaryFile.h"
00022 #include "BxDataObjects.h"
00023 
00024 class BxBinxFile;
00025 
00026 /*
00027  * - Base class for BinX parsers: BxBinxDomParser and BxBinxSaxParser.
00028  * TODO: change this comment
00029  *
00030  * The constructor of BxBinxParser creates an instance of BxDataset which is
00031  * not deleted by the destructor, but left to the caller.
00032  * The caller should grab this data object by calling getDataset() method
00033  * and release it at the end of its life cycle.
00034  *
00035  * <BR><B>Since:</B>  BinX version 1.1.
00036  *
00037  * \internal
00038  * History:
00039  * 23/09/03   Created to replace original BxBinxFile which is a sole parser.
00040  */
00041 class DECLSPEC BxBinxParser : public BxObject
00042 {
00043 public:
00044     BxBinxParser();
00045     virtual ~BxBinxParser();
00046 
00047     virtual char* className() const { return "BxBinxParser"; }
00048     BxDataset* getDataset() const { return datasetRoot_; }
00049     BxBinaryFile* getBinaryFile() { return bfile_; }
00050 
00051     virtual bool parse(const char*) { return false; } //Implemented in derived class
00052 
00053 protected:
00054     void toUpperCase(char* s);
00055     void extractFilePath(const char* binxFile);
00056 
00057     void setBinaryFile(BxBinaryFile* bfile);
00058     void createBinaryFile(const char* filename);
00059 
00060     BxDataObjects& getDefinitions() { return definitions_; }
00061     const char* getPath() const { return path_; }
00062 
00063 private:
00064     void dropDatasetFile()
00065     {
00066         datasetRoot_ = NULL; //used by BxBinxFile::parseBinxFile
00067         bfile_ = NULL;       //after taking over these pointers, so the destructor won't delete
00068     }
00069     //member variables
00070     //will be passed to the caller BxBinxFile
00071     BxDataset*  datasetRoot_;   //the BinX document dataset object, describing the content of the binary data file
00072     BxBinaryFile* bfile_;    //pointer to the open binary data file
00073 
00074     //these are local variables, released by destructor
00075     BxDataObjects  definitions_;   //the BinX document definitions secdtion, defining abstract data types
00076     char* path_;   //path of the BinX xml file, also used as the path for the binary data file
00077 
00078     friend class BxBinxFile;
00079 };
00080 
00081 #endif
00082 

Generated on Fri May 6 13:36:17 2005 for edikt::BinX by doxygen 1.3.3