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

RoomItem.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 __ROOM_ITEM_H
00021 #define __ROOM_ITEM_H
00022 
00023 #include "RootItem.h"
00024 
00025 #include "Room.h"
00026 
00027 class RoomItem : public RootItem
00028 {
00029         public: // Enums
00030                 enum Columns {COL_NAME =0, COL_CODE, COL_CAPACITY, COL_INSTITUTE};
00031         public: // Constructor
00032                 RoomItem(Room * RoomObj, RootItem *parent = 0, int cc =0);
00033                 RoomItem(RoomItem & ri);
00034                 ~RoomItem(){};
00035         // Get Methods
00036                 inline virtual Room * getItemData()const {return static_cast<Room * >(itemData);}
00037                 inline Room * getRoom() const       {return getItemData();}
00038                 inline Institute * getInstitute()   {return  getItemData()->getInstitute();}
00039                 inline QString getDescription()const{return getRoom()->getDescription();}
00040                 inline QString getInstName()const   {return getItemData()->getInstName();}
00041                 inline QString getRoomName()const   {return getItemData()->getName();}
00042                 inline QString getRoomCode()const   {return getItemData()->getCode();}
00043                 inline int getRoomCapacity()const   {return getItemData()->getCapacity();}
00044                 QVariant data(int column) const;
00045         // Set Methods
00046                 inline bool setRoomName(QString name)    {return getItemData()->setName(name);}
00047                 inline bool setRoomCode(QString code)    {return getItemData()->setCode(code);}
00048                 inline bool setRoomCapacity(int capcaity){return getItemData()->setCapacity(capcaity);}
00049                 bool setData(int column, const QVariant & value);
00050         // database manipulation
00051                 inline void dbSave();
00052                 inline void dbDelete();
00053         // diagnostic
00054 };
00055 
00056 
00057 void RoomItem::dbSave()
00058 {
00059         getRoom()->save(Room::insertSQL, Room::updateSQL, Room::errorSQL);
00060 }
00061 
00062 void RoomItem::dbDelete()
00063 {
00064         getRoom()->remove(Room::deleteSQL, Room::errorSQL);
00065 }
00066 #endif

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