Warning, file /frameworks/kservice/src/sycoca/kbuildservicefactory_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 1999, 2007 David Faure <faure@kde.org>
0004     SPDX-FileCopyrightText: 1999 Waldo Bastian <bastian@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KBUILD_SERVICE_FACTORY_H
0010 #define KBUILD_SERVICE_FACTORY_H
0011 
0012 #include <QStringList>
0013 
0014 #include "kmimeassociations_p.h"
0015 #include <kservicefactory_p.h>
0016 // We export the services to the service group factory!
0017 class KBuildServiceGroupFactory;
0018 class KBuildMimeTypeFactory;
0019 class KServiceTypeFactory;
0020 
0021 /**
0022  * Service factory for building ksycoca
0023  * @internal
0024  */
0025 class KBuildServiceFactory : public KServiceFactory
0026 {
0027 public:
0028     /**
0029      * Create factory
0030      */
0031     KBuildServiceFactory(KServiceTypeFactory *serviceTypeFactory, KBuildMimeTypeFactory *mimeTypeFactory, KBuildServiceGroupFactory *serviceGroupFactory);
0032 
0033     ~KBuildServiceFactory() override;
0034 
0035     /// Reimplemented from KServiceFactory
0036     KService::Ptr findServiceByDesktopName(const QString &name) override;
0037     /// Reimplemented from KServiceFactory
0038     KService::Ptr findServiceByDesktopPath(const QString &name) override;
0039     /// Reimplemented from KServiceFactory
0040     KService::Ptr findServiceByMenuId(const QString &menuId) override;
0041 
0042     /**
0043      * Construct a KService from a config file.
0044      */
0045     KSycocaEntry *createEntry(const QString &file) const override;
0046 
0047     KService *createEntry(int) const override
0048     {
0049         assert(0);
0050         return nullptr;
0051     }
0052 
0053     /**
0054      * Add a new entry.
0055      */
0056     void addEntry(const KSycocaEntry::Ptr &newEntry) override;
0057 
0058     /**
0059      * Write out service specific index files.
0060      */
0061     void save(QDataStream &str) override;
0062 
0063     /**
0064      * Write out header information
0065      *
0066      * Don't forget to call the parent first when you override
0067      * this function.
0068      */
0069     void saveHeader(QDataStream &str) override;
0070 
0071     void postProcessServices();
0072 
0073 private:
0074     void populateServiceTypes();
0075     void saveOfferList(QDataStream &str);
0076     void collectInheritedServices();
0077     void collectInheritedServices(const QString &mime, QSet<QString> &visitedMimes, int mimeTypeInheritanceLevel);
0078 
0079     QHash<QString, KService::Ptr> m_nameMemoryHash; // m_nameDict is not usable while building ksycoca
0080     QHash<QString, KService::Ptr> m_relNameMemoryHash; // m_relNameDict is not usable while building ksycoca
0081     QHash<QString, KService::Ptr> m_menuIdMemoryHash; // m_menuIdDict is not usable while building ksycoca
0082     QSet<KSycocaEntry::Ptr> m_dupeDict;
0083 
0084     KOfferHash m_offerHash;
0085 
0086     KServiceTypeFactory *m_serviceTypeFactory;
0087     KBuildMimeTypeFactory *m_mimeTypeFactory;
0088     KBuildServiceGroupFactory *m_serviceGroupFactory;
0089 };
0090 
0091 #endif