Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

InstItem.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Graeme Foster                                   *
00003  *   email    foster.graeme@gmail.com                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef __INST_ITEM_H
00021 #define __INST_ITEM_H
00022 
00023 #include "RootItem.h"
00024 #include "Institute.h"
00025 
00026 class InstItem : public RootItem
00027 {
00028         public: // Enums
00029                 enum Columns {COL_NAME =0, COL_ABBREV};
00030         public: // Constructor
00031                 InstItem(Institute * InstObj, RootItem *parent = 0, int cc =0);
00032                 InstItem(InstItem & ii);
00033         // Get Methods
00034                 inline virtual Institute * getItemData()const {return static_cast<Institute * >(itemData);}
00035                 inline Institute * getInstitute()   {return getItemData();}
00036                 inline QString getDescription()const{return getItemData()->getDescription();}
00037                 inline QString getInstName()const   {return getItemData()->getName();}
00038                 inline QString getInstAbbrev()const {return getItemData()->getAbbrev();}
00039                 QVariant data(int column)const;
00040         // Set Methods
00041                 inline bool setInstName(QString Name)    {return getItemData()->setName(Name);}
00042                 inline bool setInstAbbrev(QString Abbrev){return getItemData()->setAbbrev(Abbrev);}
00043                 bool setData(int column, const QVariant & value);
00044         // database manipulation
00045                 inline void dbSave();
00046                 inline void dbDelete();
00047 };
00048 
00049 void InstItem::dbSave()
00050 {
00051         getItemData()->save(Institute::insertSQL, Institute::updateSQL, Institute::errorSQL);
00052 }
00053 
00054 void InstItem::dbDelete()
00055 {
00056         getItemData()->remove(Institute::deleteSQL, Institute::errorSQL);
00057 }
00058 
00059 #endif

Generated on Thu Apr 6 16:27:17 2006 for time-table by  doxygen 1.4.4