00001 // database row base class -*- C++ -*- 00002 // $Id: row_base.h,v 1.2 2004/01/07 14:29:39 roger Exp $ 00003 // 00004 // Copyright (C) 2003 Roger Leigh <rleigh@debian.org> 00005 // 00006 // 00007 // This program is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 #ifndef PQXX_OBJECT_ROW_BASE_H 00022 #define PQXX_OBJECT_ROW_BASE_H 00023 00024 #include <sigc++/object.h> 00025 #include <sigc++/signal.h> 00026 00027 namespace pqxxobject 00028 { 00032 class row_base : public SigC::Object 00033 { 00034 public: 00035 enum state 00036 { 00037 STATE_UNINITIALISED, 00038 STATE_INITIALISED, 00039 STATE_INCONSISTENT 00040 }; 00041 00042 row_base(); 00043 00044 row_base(state status, 00045 bool modified=false); 00046 00047 row_base(const row_base& rhs); 00048 00049 virtual ~row_base(); 00050 00051 00052 row_base& operator = (const row_base& rhs); 00053 00054 state get_state() const; 00055 00056 bool is_modified() const; 00057 00058 void refresh(); 00059 void insert(); 00060 void update(); 00061 void erase(); 00062 00063 SigC::Signal0<void>& signal_changed(); 00064 SigC::Signal0<void>& signal_refreshed(); 00065 SigC::Signal0<void>& signal_inserted(); 00066 SigC::Signal0<void>& signal_updated(); 00067 SigC::Signal0<void>& signal_erased(); 00068 00069 protected: 00070 state m_state; 00071 bool m_modified; 00072 00073 virtual void refresh_impl(); 00074 virtual void insert_impl(); 00075 virtual void update_impl(); 00076 virtual void erase_impl(); 00077 00078 SigC::Signal0<void> m_signal_changed; 00079 SigC::Signal0<void> m_signal_refreshed; 00080 SigC::Signal0<void> m_signal_inserted; 00081 SigC::Signal0<void> m_signal_updated; 00082 SigC::Signal0<void> m_signal_erased; 00083 00084 }; // class row_base 00085 00086 }; // namespace pqxxobject 00087 00088 #endif // PQXX_OBJECT_ROW_BASE_H