KDECore
kcomponentdata.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Torben Weis <weis@kde.org> 00003 Copyright (C) 2007 Matthias Kretz <kretz@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 #ifndef KCOMPONENTDATA_H 00020 #define KCOMPONENTDATA_H 00021 00022 #include <kdecore_export.h> 00023 #include <ksharedconfig.h> 00024 00025 class QByteArray; 00026 class QString; 00027 class KAboutData; 00028 class KStandardDirs; 00029 class KComponentDataPrivate; 00030 00046 class KDECORE_EXPORT KComponentData // krazy:exclude=dpointer (implicitly shared) 00047 { 00048 public: 00054 KComponentData(); 00055 00061 KComponentData(const KComponentData&); 00062 00072 KComponentData &operator=(const KComponentData&); 00073 00077 bool operator==(const KComponentData&) const; 00078 00082 bool operator!=(const KComponentData &rhs) const { return !operator==(rhs); } 00083 00084 enum MainComponentRegistration { 00085 RegisterAsMainComponent, 00086 SkipMainComponentRegistration 00087 }; 00088 00100 explicit KComponentData(const QByteArray &componentName, const QByteArray &catalogName = QByteArray(), 00101 MainComponentRegistration registerAsMain = RegisterAsMainComponent); 00102 00116 explicit KComponentData(const KAboutData &aboutData, MainComponentRegistration registerAsMain = RegisterAsMainComponent); 00117 explicit KComponentData(const KAboutData *aboutData, MainComponentRegistration registerAsMain = RegisterAsMainComponent); 00118 00122 virtual ~KComponentData(); 00123 00130 bool isValid() const; 00131 00136 KStandardDirs *dirs() const; 00137 00142 const KSharedConfig::Ptr &config() const; //krazy:exclude=constref 00143 00151 const KAboutData *aboutData() const; 00152 00158 QString componentName() const; 00159 00165 QString catalogName() const; 00166 00167 protected: 00168 friend class KApplicationPrivate; 00169 00174 void setConfigName(const QString &name); 00175 00177 virtual void virtual_hook( int id, void* data ); 00178 00179 private: 00180 // Ref-counted data 00181 KComponentDataPrivate* d; 00182 friend class KComponentDataPrivate; 00183 }; 00184 00185 #endif // KCOMPONENTDATA_H