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

vdkxtable.h

00001 /*
00002  * ===========================
00003  * VDK Visual Development Kit
00004  * xdb subsystem
00005  * Version 0.1
00006  * Revision 0.0
00007  * April 2000
00008  * ===========================
00009  *
00010  * Copyright (C) 1998, Mario Motta
00011  * Developed by Mario Motta <mmotta@guest.net>
00012  *
00013  * This library is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU Library General Public
00015  * License as published by the Free Software Foundation; either
00016  * version 2 of the License, or (at your option) any later version.
00017  *
00018  * This library is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  * Library General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU Library General Public
00024  * License along with this library; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00026  * 02111-1307, USA.
00027  */
00028 
00029 #ifndef _vdkxdbtable_h
00030 #define _vdkxdbtable_h
00031 #include <vdk/vdkstring.h>
00032 #include <vdk/vdkprops.h>
00033 #include <vdk/dlist.h>
00034 #include <xdb/dbf.h>
00035 #include <xdb/ndx.h>
00036 
00037 // see into xdb/xdb/dbf.h
00038 typedef xbSchema VDKXRecordTemplate ;
00039 
00040 class VDKXDatabase;
00041 class VDKXTableIndex;
00042 
00043 
00044 typedef VDKList<VDKXTableIndex> IndexList;
00045 typedef VDKListIterator<VDKXTableIndex> IndexListIterator;
00046 
00047 
00055 class VDKXTable: public xbDbf
00056 {
00057  protected:
00059   VDKString name;
00061   IndexList iList;
00062   void SetOrder(xbShort ndx);
00063   bool open;
00064   VDKXTableIndex* activeIndex;
00065  public:
00066   /*
00067     table properties
00068   */
00070   VDKReadOnlyValueProp<VDKXTable,xbLong> Size;
00071 
00076   VDKReadWriteValueProp<VDKXTable,xbShort> Order;
00082   void SetOrder(char* name);
00087   VDKReadWriteValueProp<VDKXTable,bool> ShowDeleted;
00088   //---------------------------------------------
00089   /*
00090     Internal use only (mainly for builder)
00091     User don't care.
00092   */
00093   VDKReadWriteValueProp<VDKXTable,bool> Active;
00094   //---------------------------------------------
00101   VDKXTable(VDKXDatabase* owner, char* name);
00103   virtual ~VDKXTable();
00105   VDKString Name() { return name; }
00118   xbShort Create(VDKXRecordTemplate* tpl, bool overwrite = false);
00128   xbShort Open(void);
00135   xbShort Close(void);
00141   bool RemoveIndex(char* name);
00147   VDKXTableIndex* Index(char* name);
00153   VDKXTableIndex* Index(xbShort order);
00167   xbShort First();
00181   xbShort Last();
00195   xbShort Next();
00209   xbShort Prev();
00211   IndexList* NdxList() { return &iList; }
00213   bool IsOpen() { return open; }
00214 };
00215 
00220 class VDKXTableIndex: public xbNdx
00221 {
00222  protected:
00223   VDKString name,key;
00224   VDKXTable* table;
00225   bool open;
00226  public:
00232   VDKXTableIndex(VDKXTable* owner, char* s);
00234   virtual ~VDKXTableIndex();
00250   xbShort Create(char* key,
00251                  bool unique = true , 
00252                  bool overwrite = false
00253                  );
00255   xbShort Open(void);
00262   xbShort Close(void);
00264   VDKString Name() { return name; }
00266   VDKString Key() { return key; }
00268   bool IsOpen() { return open; }
00269 };
00270 
00271 #endif
00272 

Generated on Sat Apr 6 11:32:13 2002 for vdkxdb 0.0.4 by doxygen1.2.15