COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/libcoopy_core/include/coopy/TextBookFactory.h
Go to the documentation of this file.
00001 #ifndef COOPY_TEXTBOOKFACTORY
00002 #define COOPY_TEXTBOOKFACTORY
00003 
00004 #include <coopy/TextBook.h>
00005 #include <coopy/TextBookFactory.h>
00006 #include <coopy/Property.h>
00007 #include <coopy/Dbg.h>
00008 
00009 namespace coopy {
00010   namespace store {
00011     class TextBookFactory;
00012     class AttachConfig;
00013     class AttachReport;
00014   }
00015 }
00016 
00017 
00022 class coopy::store::AttachConfig {
00023 public:
00024   std::string fname;
00025   std::string ext;
00026   std::string data;
00027   Property options;
00028   bool canCreate;
00029   bool canOverwrite;
00030   bool shouldCreate;
00031   bool shouldRead;
00032   bool shouldWrite;
00033   TextBook *prevBook;
00034   TextBook *baseBook;
00035   Property prevOptions;
00036 
00037   AttachConfig() {
00038     canCreate = false;
00039     canOverwrite = false;
00040     shouldCreate = false;
00041     shouldRead = false;
00042     shouldWrite = false;
00043     prevBook = NULL;
00044     baseBook = NULL;
00045   }
00046 
00047   void show() const;
00048 };
00049 
00055 class coopy::store::AttachReport {
00056 public:
00057   bool success;
00058   bool applicable;
00059   std::string msg;
00060 
00061   AttachReport() {
00062     success = false;
00063     applicable = false;
00064   }
00065 
00066   void errorCreateNotImplemented(const char *str) {
00067     success = false;
00068     applicable = true;
00069     msg = std::string("Creation not implemented yet (") + str + ")";
00070   }
00071 
00072   void errorWriteNotImplemented(const char *str) {
00073     success = false;
00074     applicable = true;
00075     msg = std::string("Writing not implemented yet (") + str + ")";
00076   }
00077 };
00078 
00084 class coopy::store::TextBookFactory {
00085 public:
00086   TextBookFactory();
00087 
00088   virtual ~TextBookFactory() {
00089   }
00090 
00091   virtual std::string getName() = 0;
00092 
00093   virtual TextBook *open(AttachConfig& config, AttachReport& report) = 0;
00094 };
00095 
00096 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines