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

Document.h

00001 /*
00002    Copyright (C) 2002 - 2003 the Strongroom project
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    @author Ewald Snel
00010 */
00011 
00012 #ifndef __DOCUMENT_H
00013 #define __DOCUMENT_H
00014 
00015 #ifdef HAVE_CONFIG_H
00016 #include <config.h>
00017 #endif
00018 
00019 #include <time.h>
00020 #include <string>
00021 #include <vector>
00022 
00023 #include <AbstractDocument.h>
00024 #include <Common.h>
00025 #include <Error.h>
00026 #include <HashUtils.h>
00027 #include <XMLReader.h>
00028 #include <XMLWriter.h>
00029 
00030 
00031 using namespace std;
00032 
00036 class Revision
00037 {
00038 public:
00042     Revision();
00043 
00047     Revision( NumID fileid, string mimetype, time_t date );
00048 
00052     ~Revision();
00053 
00057     NumID getFileId();
00058 
00062     string getMimetype();
00063 
00067     time_t getDate();
00068 
00074     DocumentError addRendition( string mimetype, NumID fileid );
00075 
00080     DocumentError removeRendition( string mimetype );
00081 
00087     NumID getRendition( string mimetype );
00088 
00092     vector<string> listRenditions();
00093 
00099     void toXML( XMLWriter &xml, NumID revid ) const;
00100 
00101 private:
00102     NumID fileid;
00103     string mimetype;
00104     time_t rdate;
00105     hash_map<string,NumID,_hash_string> renditions;
00106 };
00107 
00108 
00112 class Document : public AbstractDocument
00113 {
00114 public:
00118     Document();
00119 
00125     NumID addRevision( Revision revision );
00126 
00131     DocumentError removeRevision( NumID id );
00132 
00138     DocumentError getRevision( NumID id, Revision &revision );
00139 
00144     vector<NumID> listRevisions();
00145 
00152     DocumentError addRendition( NumID revid, string mimetype, NumID fileid );
00153 
00157     string toXML() const;
00158 
00163     DocumentError fromXML( const string &str );
00164 
00165 private:
00166     hash_map<NumID,Revision,_hash_NumID> revisions;
00167     int revisionCounter;
00168 };
00169 
00170 #endif

Generated on Wed Feb 18 13:45:55 2004 for strongroom by doxygen1.2.18