kexi

kexipartitem.h
1/* This file is part of the KDE project
2 Copyright (C) 2002, 2003 Lucijan Busch <lucijan@gmx.at>
3 Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEXIPROJECTPARTITEM_H
22#define KEXIPROJECTPARTITEM_H
23
24#include <tqobject.h>
25#include <tqintdict.h>
26#include <tqptrlist.h>
27
28namespace KexiDB
29{
30 class Connection;
31}
32
33namespace KexiPart
34{
35
36class Info;
37
46class KEXICORE_EXPORT Item
47{
48 public:
49
50 Item();
51 ~Item();
52
53 int identifier() const { return m_id; }
54 void setIdentifier(int id) { m_id = id; }
55
56 TQCString mimeType() const { return m_mime; }
57 void setMimeType(const TQCString &mime) { m_mime = mime; }
58
59 TQString name() const { return m_name; }
60 void setName(const TQString &name) { m_name = name; }
61
62 TQString caption() const { return m_caption; }
63 void setCaption(const TQString &c) { m_caption = c; }
64
65 TQString description() const { return m_desc; }
66 void setDescription(const TQString &d) { m_desc = d; }
67
73 bool neverSaved() const { return m_neverSaved; }
74
77 void setNeverSaved(bool set) { m_neverSaved = set; }
78
79 bool isNull() const { return m_id==0; }
80
82 inline TQString captionOrName() const { return m_caption.isEmpty() ? m_name : m_caption; }
83
84 private:
85 TQCString m_mime;
86 TQString m_name;
87 TQString m_caption;
88 TQString m_desc;
89 int m_id;
90 bool m_neverSaved : 1;
91};
92
93typedef TQIntDict<KexiPart::Item> ItemDict;
94typedef TQIntDictIterator<KexiPart::Item> ItemDictIterator;
95typedef TQPtrListIterator<KexiPart::Item> ItemListIterator;
96
103class KEXICORE_EXPORT ItemList : public TQPtrList<KexiPart::Item> {
104 public:
105 ItemList() {}
106 protected:
107 virtual int compareItems( TQPtrCollection::Item item1, TQPtrCollection::Item item2 ) {
108 return TQString::compare(
109 static_cast<KexiPart::Item*>(item1)->name(),
110 static_cast<KexiPart::Item*>(item2)->name());
111 }
112};
113
114}
115
116#endif
117
Provides database connection, allowing queries and data modification.
Definition connection.h:62
Information about a Kexi Part (plugin).
Information about a single object that can be instantiated using Kexi Part.
bool neverSaved() const
TQString captionOrName() const
void setNeverSaved(bool set)
High-level database connectivity library with database backend drivers.