kglobal.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Sirtaj Singh Kanq <taj@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 #ifndef _KGLOBAL_H 00019 #define _KGLOBAL_H 00020 00021 #include <qstring.h> 00022 00023 class KStandardDirs; 00024 class KConfig; 00025 class KLocale; 00026 class KIconLoader; 00027 class KCharsets; 00028 class QFont; 00029 class KInstance; 00030 class KStringDict; 00031 class KStaticDeleterBase; 00032 class KStaticDeleterList; 00033 #include <kinstance.h> 00034 00045 class KGlobal 00046 { 00047 public: 00048 00055 static KInstance *instance(); 00056 00061 static KStandardDirs *dirs(); 00062 00067 static KConfig *config(); 00068 00073 static KIconLoader *iconLoader(); 00074 00079 static KLocale *locale(); 00080 00085 static KCharsets *charsets(); 00086 00104 static const QString &staticQString(const char *str); 00105 00123 static const QString &staticQString(const QString &str); 00124 00131 static void registerStaticDeleter(KStaticDeleterBase *d); 00132 00139 static void unregisterStaticDeleter(KStaticDeleterBase *d); 00140 00147 static void deleteStaticDeleters(); 00148 00149 //private: 00150 static KStringDict *_stringDict; 00151 static KInstance *_instance; 00152 static KLocale *_locale; 00153 static KCharsets *_charsets; 00154 static KStaticDeleterList *_staticDeleters; 00155 00162 static void setActiveInstance(KInstance *d); 00163 static KInstance *activeInstance() { return _activeInstance; } 00164 00165 static KInstance *_activeInstance; 00166 }; 00167 00171 #define KMIN(a,b) kMin(a,b) 00172 00175 #define KMAX(a,b) kMax(a,b) 00176 00179 #define KABS(a) kAbs(a) 00180 00181 00182 template<class T> 00183 inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; } 00184 00185 template<class T> 00186 inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; } 00187 00188 template<class T> 00189 inline T kAbs (const T& a) { return a < 0 ? -a : a; } 00190 00205 #endif // _KGLOBAL_H 00206