KDECore
kservicefactory.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00003 Copyright (C) 2006 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef __kservicefactory_h__ 00022 #define __kservicefactory_h__ 00023 00024 #include <QtCore/QStringList> 00025 00026 #include "kserviceoffer.h" 00027 #include "ksycocafactory.h" 00028 #include <assert.h> 00029 00030 class KSycoca; 00031 class KSycocaDict; 00032 00041 class KDECORE_EXPORT KServiceFactory : public KSycocaFactory 00042 { 00043 K_SYCOCAFACTORY( KST_KServiceFactory ) 00044 public: 00048 KServiceFactory(); 00049 virtual ~KServiceFactory(); 00050 00054 virtual KSycocaEntry *createEntry(const QString &, const char *) const 00055 { assert(0); return 0; } 00056 00061 KService::Ptr findServiceByName( const QString &_name ); 00062 00066 virtual KService::Ptr findServiceByDesktopName( const QString &_name ); 00067 00071 virtual KService::Ptr findServiceByDesktopPath( const QString &_name ); 00072 00076 virtual KService::Ptr findServiceByMenuId( const QString &_menuId ); 00077 00082 KServiceOfferList offers( int serviceTypeOffset, int serviceOffersOffset ); 00083 00088 KService::List serviceOffers( int serviceTypeOffset, int serviceOffersOffset ); 00089 00096 bool hasOffer( int serviceTypeOffset, int serviceOffersOffset, int testedServiceOffset ); 00097 00101 KService::List allServices(); 00102 00106 static KServiceFactory * self(); 00107 00108 protected: 00109 virtual KService * createEntry(int offset) const; 00110 00111 // All those variables are used by KBuildServiceFactory too 00112 int m_offerListOffset; 00113 KSycocaDict *m_nameDict; 00114 int m_nameDictOffset; 00115 KSycocaDict *m_relNameDict; 00116 int m_relNameDictOffset; 00117 KSycocaDict *m_menuIdDict; 00118 int m_menuIdDictOffset; 00119 00120 protected: 00121 virtual void virtual_hook( int id, void* data ); 00122 private: 00123 class KServiceFactoryPrivate* d; 00124 }; 00125 00126 #endif