Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ElemDocMgr.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  *
00003  *  Original source copyright (c) 2001, Carnegie Mellon University.
00004  *  See copyright.cmu for details.
00005  *  Modifications copyright (c) 2002, University of Massachusetts.
00006  *  See copyright.umass for details.
00007  *
00008  *==========================================================================
00009  */
00010 
00011 #ifndef _ELEMDOCMGR_HPP
00012 #define _ELEMDOCMGR_HPP
00013 
00014 #include "KeyfileDocMgr.hpp"
00015 namespace lemur 
00016 {
00017   namespace parse 
00018   {
00019     
00020     //TOC
00021 #define ELEM_TOC ".elem"
00022 #define ELEM_TOC_LEN 5
00023 
00024     // elems
00025 #define ELEM_ELS ".els"
00026 
00027     // we should really do something about this, it appears all over the toolkit
00028 #ifndef _ABC_OP
00029 #define _ABC_OP
00030     struct abc
00031     {
00032       bool operator()(char* s1, char* s2) const{
00033         return strcmp(s1, s2) < 0;
00034       }
00035     };
00036 #endif
00037 
00051     class ElemDocMgr : public KeyfileDocMgr {
00052     public:
00053 
00057       ElemDocMgr(const string &name, bool readOnly = true);
00058 
00063       ElemDocMgr(string name, string mode, string source);  
00064 
00065       virtual ~ElemDocMgr();
00066 
00068       virtual char* handleBeginTag(char* tag, const char* orig, PropertyList* props);
00069 
00071       virtual char* handleEndTag(char* tag, const char* orig, PropertyList* props);
00072 
00076       virtual char* getElement(const char* docid, const char* element) const;
00077 
00079       virtual bool open(const string &manname) {
00080         IDnameext = manname;
00081         IDname = manname.substr(0, manname.length() - 5);
00082         return loadTOC();
00083       }
00084 
00085     protected:
00086       virtual void writeTOC();
00087       virtual bool loadTOC();
00088 
00089       map<char*,btl,abc> elemtable; // map for temp creating elem strings
00090 
00091       lemur::file::Keyfile elements;  // btree for storing elements
00092     };
00093   }
00094 }
00095 
00096 #endif // _ELEMDOCMGR_HPP

Generated on Tue Jun 15 11:02:53 2010 for Lemur by doxygen 1.3.4