KDb

KDbObject.shared.h
1/* This file is part of the KDE project
2 Copyright (C) 2003-2010 Jarosław Staniek <staniek@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDB_OBJECT_H
21#define KDB_OBJECT_H
22
23#include "kdb_export.h"
24#include "KDbGlobal.h"
25
26/*! Provides common attributes for KDb objects: id, name, caption,
27 help text. A KDb object is typically storable in database, for example:
28 table schema or query schema.
29 Default type of object is KDb::UnknownObjectType.
30*/
31class KDB_EXPORT KDbObject //SDC: operator== virtual_dtor
32{
33public:
34 /*!
35 @getter
36 @return the type of this object.
37 */
38 int type; //SDC: default=KDb::UnknownObjectType no_setter
39
40 /*!
41 @getter
42 @return the identifier of this object, default is -1.
43 @setter
44 Sets the identifier for this object.
45 */
46 int id; //SDC: default=-1
47
48 /*!
49 @getter
50 @return the name of this object.
51 @setter
52 Sets the name for this object. It should be valid identifier,
53 i.e. start with underscore or latin letter, contain underscores, latin letters and digits.
54 */
55 QString name; //SDC:
56
57 /*!
58 @getter
59 @return the caption of this object, which is user-visible extended name which can be used
60 in user interfaces and translated.
61 @setter
62 Sets the caption for this object.
63 */
65
66 /*!
67 @getter
68 @return the description of this object, which is explanation
69 of the object's purpose, etc.
70 It can be any text and can be used in user interfaces and translated.
71 @setter
72 Sets the description for this object.
73 */
75
76 /*! @return caption of this object if it is not empty, else returns object's name.
77 */
78 inline QString captionOrName() const {
79 return d->caption.isEmpty() ? d->name : d->caption;
80 }
81
82 //! Creates new object of type @a type. */
83 explicit KDbObject(int type);
84
85protected:
86 //! Clears all properties except 'type'.
87 virtual void clear();
88};
89
90//! Sends information about object @a object to debug output @a dbg.
91KDB_EXPORT QDebug operator<<(QDebug dbg, const KDbObject& object);
92
93#endif
QString description
QString captionOrName() const
QString caption
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.