KDECore
kmimetypefactory.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 * Copyright (C) 1999 Waldo Bastian <bastian@kde.org> 00003 * Copyright (C) 2006-2007 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 version 2 as published by the Free Software Foundation; 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KMIMETYPEFACTORY_H 00021 #define KMIMETYPEFACTORY_H 00022 00023 #include <assert.h> 00024 00025 #include <QtCore/QStringList> 00026 00027 #include "ksycocafactory.h" 00028 #include "ksycocaentry_p.h" 00029 00030 class KSycoca; 00031 00039 class KDECORE_EXPORT KMimeTypeFactory : public KSycocaFactory 00040 { 00041 K_SYCOCAFACTORY( KST_KMimeTypeFactory ) 00042 public: 00046 KMimeTypeFactory(); 00047 00048 virtual ~KMimeTypeFactory(); 00049 00053 virtual KSycocaEntry *createEntry(const QString &, const char *) const 00054 { assert(0); return 0; } 00055 00059 int entryOffset(const QString& mimeTypeName); 00060 00064 int serviceOffersOffset(const QString& mimeTypeName); 00065 00066 public: 00071 QStringList allMimeTypes(); 00072 00076 static KMimeTypeFactory * self(); 00077 00078 public: // public for KBuildServiceFactory 00079 // A small entry for each mimetype with name and offset into the services-offer-list. 00080 class MimeTypeEntryPrivate; 00081 class KDECORE_EXPORT MimeTypeEntry : public KSycocaEntry 00082 { 00083 Q_DECLARE_PRIVATE( MimeTypeEntry ) 00084 public: 00085 typedef KSharedPtr<MimeTypeEntry> Ptr; 00086 00087 MimeTypeEntry(const QString& file, const QString& name); 00088 MimeTypeEntry(QDataStream& s, int offset); 00089 00090 int serviceOffersOffset() const; 00091 void setServiceOffersOffset(int off); 00092 }; 00093 00094 protected: 00095 virtual MimeTypeEntry *createEntry(int offset) const; 00096 private: 00097 // d pointer: useless since this header is not installed 00098 //class KMimeTypeFactoryPrivate* d; 00099 }; 00100 00101 #endif
KDE 4.6 API Reference