kexi
kexipartitem.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEXIPROJECTPARTITEM_H
00022 #define KEXIPROJECTPARTITEM_H
00023
00024 #include <qobject.h>
00025 #include <qintdict.h>
00026 #include <qptrlist.h>
00027
00028 namespace KexiDB
00029 {
00030 class Connection;
00031 }
00032
00033 namespace KexiPart
00034 {
00035
00036 class Info;
00037
00046 class KEXICORE_EXPORT Item
00047 {
00048 public:
00049
00050 Item();
00051 ~Item();
00052
00053 int identifier() const { return m_id; }
00054 void setIdentifier(int id) { m_id = id; }
00055
00056 QCString mimeType() const { return m_mime; }
00057 void setMimeType(const QCString &mime) { m_mime = mime; }
00058
00059 QString name() const { return m_name; }
00060 void setName(const QString &name) { m_name = name; }
00061
00062 QString caption() const { return m_caption; }
00063 void setCaption(const QString &c) { m_caption = c; }
00064
00065 QString description() const { return m_desc; }
00066 void setDescription(const QString &d) { m_desc = d; }
00067
00073 bool neverSaved() const { return m_neverSaved; }
00074
00077 void setNeverSaved(bool set) { m_neverSaved = set; }
00078
00079 bool isNull() const { return m_id==0; }
00080
00082 inline QString captionOrName() const { return m_caption.isEmpty() ? m_name : m_caption; }
00083
00084 private:
00085 QCString m_mime;
00086 QString m_name;
00087 QString m_caption;
00088 QString m_desc;
00089 int m_id;
00090 bool m_neverSaved : 1;
00091 };
00092
00093 typedef QIntDict<KexiPart::Item> ItemDict;
00094 typedef QIntDictIterator<KexiPart::Item> ItemDictIterator;
00095 typedef QPtrListIterator<KexiPart::Item> ItemListIterator;
00096
00103 class KEXICORE_EXPORT ItemList : public QPtrList<KexiPart::Item> {
00104 public:
00105 ItemList() {}
00106 protected:
00107 virtual int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ) {
00108 return QString::compare(
00109 static_cast<KexiPart::Item*>(item1)->name(),
00110 static_cast<KexiPart::Item*>(item2)->name());
00111 }
00112 };
00113
00114 }
00115
00116 #endif
00117
|