00001 // Describable - thing with a text description 00002 // Copyright (C) 2002-2003 bozo & sgbeal @users.sourceforge.net 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 #ifndef _FUN_DESCRIBABLE_H 00019 #define _FUN_DESCRIBABLE_H 00020 00021 #include <fun/Serializable.h> 00022 00023 namespace fun 00024 { 00025 00026 /** 00027 * This is just a simple interface for objects which have some sort of 00028 * description string which can be set and retrieved. I wanted it to be a 00029 * QObject so that it could emit a signal when its description changed; 00030 * see Nameable.h for why it isn't. 00031 */ 00032 class Describable : /*public QObject,*/ public virtual Serializable 00033 { 00034 // Q_ O B J E C T; 00035 public: 00036 /** 00037 * Returns this object's description. 00038 */ 00039 virtual QString getDescription() const { return descr; } 00040 00041 // public slots: 00042 /** 00043 * Sets this object's description & emits the descrChanged() signal. 00044 */ 00045 virtual void setDescription(const QString &newDescr); 00046 00047 // signals: 00048 // virtual void descrChanged(QString); 00049 00050 public: 00051 virtual void serialize(Serializer &ser) const; 00052 /** 00053 * Note that this does not emit the descrChanged() signal. 00054 */ 00055 virtual void deserialize(const Deserializer &ser); 00056 00057 private: 00058 QString descr; 00059 }; 00060 00061 } // namespace fun 00062 00063 #endif // _FUN_DESCRIBABLE_H