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

Fl_Memory_DS.h

00001 /*
00002 *
00003 * Extended Fast Light Toolkit (EFLTK)
00004 * Copyright (C) 2002-2003 by EDE-Team
00005 * WWW: http://www.sourceforge.net/projects/ede
00006 *
00007 * Fast Light Toolkit (FLTK)
00008 * Copyright (C) 1998-2003 by Bill Spitzak and others.
00009 * WWW: http://www.fltk.org
00010 *
00011 * This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00012 * version 2. See COPYING for details.
00013 *
00014 * Author : Alexey Parshin
00015 * Email  : alexey@fltk.net
00016 *
00017 * Please report all bugs and problems to "efltk-bugs@fltk.net"
00018 *
00019 */
00020 
00021 #ifndef _FL_MEMORY_DS_H_
00022 #define _FL_MEMORY_DS_H_
00023 
00024 #include <efltk/Fl_Data_Fields.h>
00025 #include <efltk/Fl_Data_Source.h>
00026 #include <efltk/Fl_Exception.h>
00027 
00029 class FL_API Fl_Memory_DS : public Fl_Data_Source  {
00030 protected:
00031     // ctor, prevent creating the instance of that class
00032     Fl_Memory_DS() : Fl_Data_Source(0L), m_current(0L), m_currentIndex(-1) { }
00033 public:
00034     // dtor
00035     virtual ~Fl_Memory_DS() { close(); }
00036     virtual void clear();
00037 
00038     // access to the field by name
00039     virtual const Fl_Variant& operator [] (const char *field_name) const;
00040     virtual Fl_Variant&       operator [] (const char *field_name);
00041 
00042     virtual const Fl_Data_Field& field (int field_index) const;
00043     virtual Fl_Data_Field&       field (int field_index);
00044     virtual void             *user_data() const { return m_current->user_data(); }
00045 
00046     // how many fields do we have in the current record?
00047     virtual unsigned          field_count() const;
00048     virtual int               field_index(const char *field_name) const;
00049 
00050      // how many rows do we have ds?
00051     virtual unsigned          record_count() const;
00052 
00053     // access to the field by number, 0..field_count()-1
00054     virtual const Fl_Variant& operator [] (int) const;
00055     virtual Fl_Variant&       operator [] (int);
00056 
00057     virtual bool              read_field(const char *fname,Fl_Variant& fvalue);
00058     virtual bool              write_field(const char *fname,const Fl_Variant& fvalue);
00059 
00060     // dataset navigation
00061     virtual bool              open() { fl_throw("Not implemented yet"); }
00062     virtual bool              close();
00063     virtual bool              first();
00064     virtual bool              next();
00065     virtual bool              prior();
00066     virtual bool              last();
00067     virtual bool              find(Fl_Variant position);
00068     virtual bool              eof() const { return m_eof; }
00069 
00070 protected:
00071     // these methods should be implemented in derived class
00072     virtual bool load_data() { return true; }
00073     virtual bool save_data() { return true; }
00074 
00075     Fl_Ptr_List         m_list;
00076     Fl_Data_Fields     *m_current;
00077     int                 m_currentIndex;
00078     bool                m_eof;
00079 };
00080 
00081 #endif

Generated on Thu Jul 31 15:33:44 2003 for eFLTK by doxygen1.2.15