DLDocument.h

Go to the documentation of this file.
00001 #ifndef _DLDOCUMENT_H_
00002 #define _DLDOCUMENT_H_
00003 
00004 #include "DLPage.h"
00005 #include "DLImage.h"
00006 #include "DLTagList.h"
00007 #include "DLConst.h"
00008 #include "DLException.h"
00009 
00010 #include <list>
00011 #include <string>
00012 
00013 class DLPage;
00014 
00015 using namespace std;
00016 
00017 
00065 class DLDocument
00066 {
00067    friend class DLPage;
00068 
00069    public:
00070 
00078    typedef std::list <DLPage*>::iterator DLPagePtrIterator;
00079 
00084    DLPagePtrIterator begin() { return documentPages.begin(); };
00085 
00093    DLPagePtrIterator end() { return documentPages.end(); };
00094         
00099    bool dlIsPageIteratorValid(DLPagePtrIterator pageIter);
00100 
00104    DLDocument();
00105 
00112    DLDocument(const DLImage &documentImage, const string &pageID, const string &docID);
00113 
00120    DLDocument(const char *imageFileName, const string &pageID, const string &documentID);
00121 
00132    DLDocument(const DLDocument &right);
00133 
00140    // DLDocument(const char *imageFileName, const char *XMLFileName, string docID);
00141 
00149    virtual ~DLDocument();
00150 
00161    DLDocument& operator=(const DLDocument &right);
00162 
00167    string dlGetDocumentID() const { return documentID; };
00168 
00173    void dlSetDocumentID(const string &docID) { documentID = docID; };
00174     
00179    int dlGetNumPages() const { return static_cast<int>(documentPages.size()); };
00180 
00185    bool dlHasPages() const { return (!documentPages.empty()); };
00186 
00207    void dlAppendPage(DLPage *docPage);
00208 
00216    void dlAppendPageList(list <DLPage*> pageList);
00217 
00227    void dlInsertPage(DLPagePtrIterator pageIter, DLPage *docPage);
00228 
00241    void dlInsertPage(int cursorPosition, DLPage *docPage);
00242 
00251    void dlInsertPageList(DLPagePtrIterator pageIter, list <DLPage*> pageList);
00252 
00264    void dlInsertPageList(int cursorPosition, list <DLPage*> pageList);
00265 
00273    void dlDeletePage(DLPagePtrIterator pageIter);
00274 
00282    void dlDeletePage(int cursorPosition);
00283 
00289    void dlDeletePage(DLPage *documentPage);
00290 
00295    void dlClearPages();
00296 
00298 
00299 
00305    string dlGetTag(string tagKey) const;
00306 
00317    void dlSetTag(string tagKey, string tagValue, bool overwriteEnabled = false);
00318 
00323    void dlDeleteTag(string tagKey);
00324 
00328    void dlClearTags() { documentTags.tagMap.clear(); };
00329 
00335    bool dlIsTagSet(string tagKey) const;
00336 
00341    bool dlIsTagListEmpty()  const { return documentTags.tagMap.empty(); };
00342 
00347    DLTagList::iterator dlFindTag ( string tagKey ) { return documentTags.tagMap.find(tagKey); }
00348 
00350 
00351    protected:
00352 
00353    string documentID;
00354 
00355    // list of attributes
00356    DLTagList documentTags;
00357 
00358    // list of document pages
00359    list <DLPage*> documentPages;
00360 
00361    // list of pages whose DLDocument *pageDocument point to this document
00362    // this enables the DLDocument to keep track of its associated DLPages when its destructor is invoked
00363    list <DLPage*> pageBackPointers;
00364 
00365 }; //end class
00366 
00367 #endif //_DLDOCUMENT_H_

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007