COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/libcoopy_core/include/coopy/WrapBook.h
Go to the documentation of this file.
00001 #ifndef COOPY_WRAPBOOK
00002 #define COOPY_WRAPBOOK
00003 
00004 #include <coopy/TextBook.h>
00005 #include <coopy/PolySheet.h>
00006 #include <coopy/Dbg.h>
00007 
00008 namespace coopy {
00009   namespace store {
00010     class WrapBook;
00011   }
00012 }
00013 
00014 class coopy::store::WrapBook : public TextBook {
00015 public:
00016   std::string name;
00017   PolySheet sheet;
00018 
00019   WrapBook() {
00020     name = "";
00021   }
00022 
00023   WrapBook(DataSheet& sheet, bool owned) : sheet(&sheet,owned),
00024     name(coopy_get_default_table_name()) {
00025   }
00026 
00027   WrapBook(PolySheet sheet) : sheet(sheet), 
00028     name(coopy_get_default_table_name()) {
00029   }
00030 
00031   bool attach(DataSheet& sheet, bool owned=false) {
00032     sheet = PolySheet(&sheet,owned);
00033     name = coopy_get_default_table_name();
00034     return true;
00035   }
00036 
00037   virtual std::vector<std::string> getNames() {
00038     std::vector<std::string> result;
00039     result.push_back(name);
00040     return result;
00041   }
00042 
00043   virtual PolySheet readSheet(const std::string& name) {
00044     if (name==this->name) {
00045       return sheet;
00046     }
00047     return PolySheet();
00048   }
00049 
00050   virtual std::string desc() const {
00051     return "WrapBook";
00052   }
00053 
00054   virtual bool namedSheets() const {
00055     return false;
00056   }
00057 };
00058 
00059 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines