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

AbstractDocument.h

00001 /*
00002    Copyright (C) 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 __ABSTRACTDOCUMENT_H
00013 #define __ABSTRACTDOCUMENT_H
00014 
00015 #ifdef HAVE_CONFIG_H
00016 #include <config.h>
00017 #endif
00018 
00019 #include <string>
00020 #include <vector>
00021 
00022 #include <Common.h>
00023 #include <Error.h>
00024 #include <HashUtils.h>
00025 #include <XMLReader.h>
00026 #include <XMLWriter.h>
00027 
00028 
00029 using namespace std;
00030 
00034 class AbstractDocument
00035 {
00036 public:
00040     AbstractDocument();
00041 
00045     vector<string> getFieldNames() const;
00046 
00052     DocumentError getField( string name, string &value ) const;
00053 
00060     DocumentError setField( string name, string value, bool exists = false );
00061 
00065     virtual string toXML() const = 0;
00066 
00071     virtual DocumentError fromXML( const string &xml ) = 0;
00072 
00073 protected:
00077     void fieldsToXML( XMLWriter &xml, const char *prefix ) const;
00078 
00082     void fieldsFromXML( XMLReader &xml, const char *prefix,
00083                         const hash_set<string,_hash_string> &ns_set ) throw (ParseException);
00084 
00085 private:
00086     hash_map<string,string,_hash_string> fields;
00087 };
00088 
00089 #endif

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