tdeglobal.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., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef _TDEGLOBAL_H 00019 #define _TDEGLOBAL_H 00020 00021 #include "tdelibs_export.h" 00022 #include <kinstance.h> // KDE4: class TDEInstance is enough here 00023 00024 class KCharsets; 00025 class TDEConfig; 00026 class TDESharedConfig; 00027 class TDEIconLoader; 00028 class TDEHardwareDevices; 00029 class TDEGlobalNetworkManager; 00030 class TDELocale; 00031 class TDEStandardDirs; 00032 class KStaticDeleterBase; 00033 class KStaticDeleterList; 00034 class KStringDict; 00035 class TQString; 00036 00046 class TDECORE_EXPORT TDEGlobal 00047 { 00048 public: 00049 00056 static TDEInstance *instance(); 00057 00062 static TDEStandardDirs *dirs(); 00063 00068 static TDEConfig *config(); 00069 00074 static TDESharedConfig *sharedConfig(); 00075 00080 static TDEIconLoader *iconLoader(); 00081 00086 static TDEHardwareDevices *hardwareDevices(); 00087 00092 static TDEGlobalNetworkManager *networkManager(); 00093 00098 static TDELocale *locale(); 00099 00104 static KCharsets *charsets(); 00105 00123 static const TQString &staticQString(const char *str); 00124 00142 static const TQString &staticQString(const TQString &str); 00143 00150 static void registerStaticDeleter(KStaticDeleterBase *d); 00151 00158 static void unregisterStaticDeleter(KStaticDeleterBase *d); 00159 00166 static void deleteStaticDeleters(); 00167 00168 //private: 00169 static KStringDict *_stringDict; 00170 static TDEInstance *_instance; 00171 static TDELocale *_locale; 00172 static KCharsets *_charsets; 00173 static KStaticDeleterList *_staticDeleters; 00174 00181 static void setActiveInstance(TDEInstance *d); 00182 static TDEInstance *activeInstance() { return _activeInstance; } 00183 00184 static TDEInstance *_activeInstance; 00185 }; 00186 00191 #define KMIN(a,b) kMin(a,b) 00192 00196 #define KMAX(a,b) kMax(a,b) 00197 00201 #define KABS(a) kAbs(a) 00202 00207 #define KCLAMP(x,low,high) kClamp(x,low,high) 00208 00209 // XXX KDE4: Make kMin, kMax and kClamp return "T" instead of "const T &"! 00210 template<class T> 00211 inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; } 00212 00213 template<class T> 00214 inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; } 00215 00216 template<class T> 00217 inline T kAbs (const T& a) { return a < 0 ? -a : a; } 00218 00219 template<class T> 00220 inline const T& kClamp( const T& x, const T& low, const T& high ) 00221 { 00222 if ( x < low ) return low; 00223 else if ( high < x ) return high; 00224 else return x; 00225 } 00226 00233 int TDECORE_EXPORT kasciistricmp( const char *str1, const char *str2 ); 00234 00235 00250 #endif // _TDEGLOBAL_H 00251
Trinity API Reference