Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

LCD_DocumentImpl.hh

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // $Id: LCD_DocumentImpl.hh,v 1.10 2004/02/03 12:45:21 uid561 Exp $
00003 // ----------------------------------------------------------------------------
00004 //
00005 // LCD_DocumentImpl  -- inherits from near-virtual base class
00006 
00007 #ifndef LCD_DOCUMENT_IMPL_H
00008 #define LCD_DOCUMENT_IMPL_H
00009 
00010 #include "LCD_DocListener.hh"
00011 #include "LCD_Document.hh"
00012 #include "xercesc/dom/deprecated/DOMParser.hpp"
00013 #include <list>
00014 #include <string>
00015 
00016 class LCD_DocErrorReporter;
00017 class LCD_DocManager;
00018 
00019 typedef int Timestamp;
00020 
00021 class LCD_DocumentImpl : public LCD_Document {
00022   // Might also add methods of one sort or another to allow this class
00023   // to know when the underlying DOM_Document has been modified.
00024   // If so, they should probably come from a different interface.
00025 public:
00026   void registerListener(LCD_DocListener* ls);
00027   int deleteListener(LCD_DocListener* ls);
00028   void notifyListeners();
00029 
00030   XERCES_CPP_NAMESPACE::DOM_Element
00031   getElement(XERCES_CPP_NAMESPACE::DOMString id,
00032              XERCES_CPP_NAMESPACE::DOMString elementName
00033               = XERCES_CPP_NAMESPACE::DOMString("*")) const;
00034 
00035 private:
00036   LCD_DocumentImpl(std::string XMLfilespec); // only for friends..
00037   void parse();
00038 
00039   friend class LCD_DocManager;     // ..like LCD_DocManager
00040 
00041   // May want something like the following:
00042   //  Vector<LCD_DocListener> getListeners();
00043 
00044   // Other methods are declared in LCD_Document header.
00045 
00046   // Might want to save more stuff from special attributes of file
00047 
00048 private:
00049   std::string                  filespec;     // ..of root XML file
00050   std::list<LCD_DocListener*> *listeners;
00051 
00052   Timestamp                    firstRead; // when DOM was created from the file
00053   Timestamp                    lastMod;
00054 
00055   XERCES_CPP_NAMESPACE::DOMParser  *parser;
00056   LCD_DocErrorReporter        *errReporter;
00057 
00058   // May also want to keep a list of mods since last notification.
00059   // items in the list would perhaps have several fields, e.g.
00060   //    ptr or ref to node modified
00061   //    node type (e.g. element or attribute)
00062   //    code for type of modification
00063 
00064   // Another optimization might be to scan the DOM after it is built and
00065   // form ancillary information such as
00066   //     - max depth of tree
00067   //     - hash table to find elements by id (in this case only need
00068   //       the simplest form of getElement)
00069   // If so, better sign up to be notified for updates so that the
00070   // ancillary information can be kept current.
00071 };
00072 #endif

Generated on Thu Oct 7 18:44:46 2004 for LCDG4 by doxygen 1.3.4