KService

ksycoca.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1999 Waldo Bastian <[email protected]>
4  SPDX-FileCopyrightText: 2005-2008 David Faure <[email protected]>
5  SPDX-FileCopyrightText: 2020 Harald Sitter <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-only
8 */
9 
10 #ifndef KSYCOCA_H
11 #define KSYCOCA_H
12 
13 #include <kservice_export.h>
14 #include <ksycocatype.h>
15 
16 #include <QObject>
17 #include <QStringList>
18 
19 class QDataStream;
20 class KSycocaFactory;
21 class KSycocaFactoryList;
22 class KSycocaPrivate;
23 
27 #define KBUILDSYCOCA_EXENAME "kbuildsycoca5"
28 
33 class KSERVICE_EXPORT KSycoca : public QObject
34 {
35  Q_OBJECT
36  //Q_CLASSINFO("D-Bus Interface", "org.kde.KSycoca")
37 
38 protected:
43  explicit KSycoca(bool /* buildDatabase */);
44 
45 public:
50  typedef enum { LocalDatabase, GlobalDatabase } DatabaseType; // TODO KF6: remove
51 
55  KSycoca();
56 
60  static KSycoca *self();
61 
62  ~KSycoca() override;
63 
67  static int version();
68 
74  static bool isAvailable();
75 
80  QDataStream *findEntry(int offset, KSycocaType &type); // KF6: make it private
85  QDataStream *findFactory(KSycocaFactoryId id); // KF6: make it private
86 
101  static QString absoluteFilePath(DatabaseType type = LocalDatabase);
102 
103 #if KSERVICE_ENABLE_DEPRECATED_SINCE(5, 15)
104 
107  KSERVICE_DEPRECATED_VERSION(5, 15, "No longer use.")
108  QString language(); // KF6: remove
109 
116  KSERVICE_DEPRECATED_VERSION(5, 15, "No longer use.")
117  quint32 timeStamp(); // KF6: remove
118 
128  KSERVICE_DEPRECATED_VERSION(5, 15, "No longer use.")
129  quint32 updateSignature(); // KF6: remove
130 #endif
131 
136  QStringList allResourceDirs(); // KF6: make it private
137 
141  void addFactory(KSycocaFactory *); // KF6: make it private
142 
147  virtual bool isBuilding();
148 
156  static void disableAutoRebuild();
157 
158 #if KSERVICE_ENABLE_DEPRECATED_SINCE(5, 0)
159 
167  KSERVICE_DEPRECATED_VERSION(5, 0, "Use signal KSycoca::databaseChanged(QStringList)")
168  static bool isChanged(const char *type);
169 #endif
170 
175  static void flagError();
176 
196  void ensureCacheValid(); // Warning for kservice code: this can delete all the factories.
197 
198 Q_SIGNALS:
208  void databaseChanged();
209 
221  void databaseChanged(const QStringList &changedResources); // KF6: deprecate
222 
223 protected:
224  // @internal used by kbuildsycoca
225  KSycocaFactoryList *factories();
226 
227  // @internal used by factories and kbuildsycoca
228  QDataStream *&stream();
229  friend class KSycocaFactory;
230  friend class KSycocaDict;
231 
232  void connectNotify(const QMetaMethod &signal) override;
233 
234 private:
239  static void clearCaches();
240 
241  bool needsRebuild();
242 
243  friend class KBuildSycoca;
244  friend class Kded;
245  friend class KSycocaPrivate;
246  friend class KSycocaXdgDirsTest;
247 
249  KSycocaPrivate *const d;
250 };
251 
252 #endif
253 
virtual void connectNotify(const QMetaMethod &signal)
Q_DISABLE_COPY(Class)
DatabaseType
type of database
Definition: ksycoca.h:50
KSycocaFactoryId
Definition: ksycocatype.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Oct 30 2020 22:51:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.