~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to kdevdesigner/designer/metadatabase.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
** Copyright (C) 2000 Trolltech AS.  All rights reserved.
 
3
**
 
4
** This file is part of Qt Designer.
 
5
**
 
6
** This file may be distributed and/or modified under the terms of the
 
7
** GNU General Public License version 2 as published by the Free Software
 
8
** Foundation and appearing in the file LICENSE.GPL included in the
 
9
** packaging of this file.
 
10
**
 
11
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
 
12
** licenses may use this file in accordance with the Qt Commercial License
 
13
** Agreement provided with the Software.
 
14
**
 
15
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
16
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
17
**
 
18
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
19
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
20
**   information about Qt Commercial License Agreements.
 
21
**
 
22
** Contact info@trolltech.com if any conditions of this licensing are
 
23
** not clear to you.
 
24
**
 
25
**********************************************************************/
 
26
 
 
27
#ifndef METADATABASE_H
 
28
#define METADATABASE_H
 
29
 
 
30
#include <qvariant.h>
 
31
#include <qstring.h>
 
32
#include <qstringlist.h>
 
33
#include <qmap.h>
 
34
#include <qptrlist.h>
 
35
#include <qsizepolicy.h>
 
36
#include <qsize.h>
 
37
#include <qwidgetlist.h>
 
38
#include <qcursor.h>
 
39
 
 
40
#include "pixmapchooser.h"
 
41
#include "../interfaces/languageinterface.h"
 
42
 
 
43
class QObject;
 
44
class QPixmap;
 
45
struct LanguageInterface;
 
46
 
 
47
class MetaDataBase
 
48
{
 
49
public:
 
50
    struct Connection
 
51
    {
 
52
        QObject *sender, *receiver;
 
53
        QCString signal, slot;
 
54
        bool operator==( const Connection &c ) const {
 
55
            return sender == c.sender && receiver == c.receiver &&
 
56
                   signal == c.signal && slot == c.slot ;
 
57
        }
 
58
    };
 
59
 
 
60
    struct Function
 
61
    {
 
62
        QString returnType;
 
63
        QCString function;
 
64
        QString specifier;
 
65
        QString access;
 
66
        QString type;
 
67
        QString language;
 
68
        bool operator==( const Function &f ) const {
 
69
            return ( returnType == f.returnType &&
 
70
                     function == f.function &&
 
71
                     specifier == f.specifier &&
 
72
                     access == f.access &&
 
73
                     type == f.type &&
 
74
                     language == f.language
 
75
                     );
 
76
        }
 
77
    };
 
78
 
 
79
    struct Property
 
80
    {
 
81
        QCString property;
 
82
        QString type;
 
83
        bool operator==( const Property &p ) const {
 
84
            return property == p.property &&
 
85
                 type == p.type;
 
86
        }
 
87
    };
 
88
 
 
89
    struct CustomWidget
 
90
    {
 
91
        CustomWidget();
 
92
        CustomWidget( const CustomWidget &w );
 
93
        ~CustomWidget() { delete pixmap; } // inlined to work around 2.7.2.3 bug
 
94
        bool operator==( const CustomWidget &w ) const;
 
95
        CustomWidget &operator=( const CustomWidget &w );
 
96
 
 
97
        bool hasSignal( const QCString &signal ) const;
 
98
        bool hasSlot( const QCString &slot ) const;
 
99
        bool hasProperty( const QCString &prop ) const;
 
100
 
 
101
        enum IncludePolicy { Global, Local };
 
102
        QString className;
 
103
        QString includeFile;
 
104
        IncludePolicy includePolicy;
 
105
        QSize sizeHint;
 
106
        QSizePolicy sizePolicy;
 
107
        QPixmap *pixmap;
 
108
        QValueList<QCString> lstSignals;
 
109
        QValueList<Function> lstSlots;
 
110
        QValueList<Property> lstProperties;
 
111
        int id;
 
112
        bool isContainer;
 
113
    };
 
114
 
 
115
    struct Include
 
116
    {
 
117
        Include() : header(), location(), implDecl( "in implementation" ) {}
 
118
        QString header;
 
119
        QString location;
 
120
        bool operator==( const Include &i ) const {
 
121
            return header == i.header && location == i.location;
 
122
        }
 
123
        QString implDecl;
 
124
    };
 
125
 
 
126
    struct Variable
 
127
    {
 
128
        QString varName;
 
129
        QString varAccess;
 
130
        bool operator==( const Variable &v ) const {
 
131
            return varName == v.varName &&
 
132
                   varAccess == v.varAccess;
 
133
        }
 
134
    };
 
135
 
 
136
    struct MetaInfo
 
137
    {
 
138
        MetaInfo() : classNameChanged( FALSE ) { }
 
139
        QString className;
 
140
        bool classNameChanged;
 
141
        QString comment;
 
142
        QString author;
 
143
    };
 
144
 
 
145
    MetaDataBase();
 
146
    static void clearDataBase();
 
147
 
 
148
    static void addEntry( QObject *o );
 
149
    static void removeEntry( QObject *o );
 
150
    static void setPropertyChanged( QObject *o, const QString &property, bool changed );
 
151
    static bool isPropertyChanged( QObject *o, const QString &property );
 
152
    static void setPropertyComment( QObject *o, const QString &property, const QString &comment );
 
153
    static QString propertyComment( QObject *o, const QString &property );
 
154
    static QStringList changedProperties( QObject *o );
 
155
 
 
156
    static void setFakeProperty( QObject *o, const QString &property, const QVariant& value );
 
157
    static QVariant fakeProperty( QObject * o, const QString &property );
 
158
    static QMap<QString,QVariant>* fakeProperties( QObject* o );
 
159
 
 
160
    static void setSpacing( QObject *o, int spacing );
 
161
    static int spacing( QObject *o );
 
162
    static void setMargin( QObject *o, int margin );
 
163
    static int margin( QObject *o );
 
164
 
 
165
    static void setResizeMode( QObject *o, const QString &mode );
 
166
    static QString resizeMode( QObject *o );
 
167
 
 
168
    static void addConnection( QObject *o, QObject *sender, const QCString &signal,
 
169
                               QObject *receiver, const QCString &slot, bool addCode = TRUE );
 
170
    static void removeConnection( QObject *o, QObject *sender, const QCString &signal,
 
171
                                  QObject *receiver, const QCString &slot );
 
172
    static bool hasConnection( QObject *o, QObject *sender, const QCString &signal,
 
173
                               QObject *receiver, const QCString &slot );
 
174
    static void setupConnections( QObject *o, const QValueList<LanguageInterface::Connection> &conns );
 
175
    static QValueList<Connection> connections( QObject *o );
 
176
    static QValueList<Connection> connections( QObject *o, QObject *sender, QObject *receiver );
 
177
    static QValueList<Connection> connections( QObject *o, QObject *object );
 
178
    static void doConnections( QObject *o );
 
179
 
 
180
    static void addFunction( QObject *o, const QCString &function, const QString &specifier,
 
181
                             const QString &access, const QString &type, const QString &language,
 
182
                             const QString &returnType );
 
183
    static void removeFunction( QObject *o, const QCString &function, const QString &specifier,
 
184
                                const QString &access, const QString &type, const QString &language,
 
185
                                const QString &returnType );
 
186
    static void removeFunction( QObject *o, const QString &function );
 
187
    static QValueList<Function> functionList( QObject *o, bool onlyFunctions = FALSE );
 
188
    static QValueList<Function> slotList( QObject *o );
 
189
    static bool isSlotUsed( QObject *o, const QCString &slot );
 
190
    static bool hasFunction( QObject *o, const QCString &function, bool onlyCustom = FALSE );
 
191
    static bool hasSlot( QObject *o, const QCString &slot, bool onlyCustom = FALSE );
 
192
    static void changeFunction( QObject *o, const QString &function, const QString &newName,
 
193
                                const QString &returnType );
 
194
    static void changeFunctionAttributes( QObject *o, const QString &oldName, const QString &newName,
 
195
                                      const QString &specifier, const QString &access,
 
196
                                      const QString &type, const QString &language,
 
197
                                      const QString &returnType );
 
198
    static QString languageOfFunction( QObject *o, const QCString &function );
 
199
    static void setFunctionList( QObject *o, const QValueList<Function> &functionList );
 
200
 
 
201
 
 
202
    static bool addCustomWidget( CustomWidget *w );
 
203
    static void removeCustomWidget( CustomWidget *w );
 
204
    static QPtrList<CustomWidget> *customWidgets();
 
205
    static CustomWidget *customWidget( int id );
 
206
    static bool isWidgetNameUsed( CustomWidget *w );
 
207
    static bool hasCustomWidget( const QString &className );
 
208
 
 
209
    static void setTabOrder( QWidget *w, const QWidgetList &order );
 
210
    static QWidgetList tabOrder( QWidget *w );
 
211
 
 
212
    static void setIncludes( QObject *o, const QValueList<Include> &incs );
 
213
    static QValueList<Include> includes( QObject *o );
 
214
 
 
215
    static void setForwards( QObject *o, const QStringList &fwds );
 
216
    static QStringList forwards( QObject *o );
 
217
 
 
218
    static void setVariables( QObject *o, const QValueList<Variable> &vars );
 
219
    static void addVariable( QObject *o, const QString &name, const QString &access );
 
220
    static void removeVariable( QObject *o, const QString &name );
 
221
    static QValueList<Variable> variables( QObject *o );
 
222
    static bool hasVariable( QObject *o, const QString &name );
 
223
    static QString extractVariableName( const QString &name );
 
224
 
 
225
    static void setSignalList( QObject *o, const QStringList &sigs );
 
226
    static QStringList signalList( QObject *o );
 
227
 
 
228
    static void setMetaInfo( QObject *o, MetaInfo mi );
 
229
    static MetaInfo metaInfo( QObject *o );
 
230
 
 
231
    static void setCursor( QWidget *w, const QCursor &c );
 
232
    static QCursor cursor( QWidget *w );
 
233
 
 
234
    static void setPixmapArgument( QObject *o, int pixmap, const QString &arg );
 
235
    static QString pixmapArgument( QObject *o, int pixmap );
 
236
    static void clearPixmapArguments( QObject *o );
 
237
 
 
238
    static void setPixmapKey( QObject *o, int pixmap, const QString &arg );
 
239
    static QString pixmapKey( QObject *o, int pixmap );
 
240
    static void clearPixmapKeys( QObject *o );
 
241
 
 
242
    static void setColumnFields( QObject *o, const QMap<QString, QString> &columnFields );
 
243
    static QMap<QString, QString> columnFields( QObject *o );
 
244
 
 
245
    static void setEditor( const QStringList &langs );
 
246
    static bool hasEditor( const QString &lang );
 
247
 
 
248
    static void setupInterfaceManagers( const QString &plugDir );
 
249
    static QStringList languages();
 
250
 
 
251
    static LanguageInterface *languageInterface( const QString &lang );
 
252
 
 
253
    static QString normalizeFunction( const QString &f );
 
254
 
 
255
    static void clear( QObject *o );
 
256
 
 
257
    static void setBreakPoints( QObject *o, const QValueList<uint> &l );
 
258
    static void setBreakPointCondition( QObject *o, int line, const QString &condition );
 
259
    static QValueList<uint> breakPoints( QObject *o );
 
260
    static QString breakPointCondition( QObject *o, int line );
 
261
 
 
262
    static void setExportMacro( QObject *o, const QString &macro );
 
263
    static QString exportMacro( QObject *o );
 
264
 
 
265
    static bool hasObject( QObject *o );
 
266
 
 
267
};
 
268
 
 
269
#endif