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 #ifdef __TDE_HAVE_TDEHWLIB 00029 class TDEHardwareDevices; 00030 class TDEGlobalNetworkManager; 00031 #endif 00032 class TDELocale; 00033 class TDEStandardDirs; 00034 class KStaticDeleterBase; 00035 class KStaticDeleterList; 00036 class KStringDict; 00037 class TQString; 00038 00048 class TDECORE_EXPORT TDEGlobal 00049 { 00050 public: 00051 00058 static TDEInstance *instance(); 00059 00064 static TDEStandardDirs *dirs(); 00065 00070 static TDEConfig *config(); 00071 00076 static TDESharedConfig *sharedConfig(); 00077 00082 static TDEIconLoader *iconLoader(); 00083 00084 #ifdef __TDE_HAVE_TDEHWLIB 00085 00089 static TDEHardwareDevices *hardwareDevices(); 00090 00095 static TDEGlobalNetworkManager *networkManager(); 00096 #endif 00097 00102 static TDELocale *locale(); 00103 00108 static KCharsets *charsets(); 00109 00127 static const TQString &staticQString(const char *str); 00128 00146 static const TQString &staticQString(const TQString &str); 00147 00154 static void registerStaticDeleter(KStaticDeleterBase *d); 00155 00162 static void unregisterStaticDeleter(KStaticDeleterBase *d); 00163 00170 static void deleteStaticDeleters(); 00171 00172 //private: 00173 static KStringDict *_stringDict; 00174 static TDEInstance *_instance; 00175 static TDELocale *_locale; 00176 static KCharsets *_charsets; 00177 static KStaticDeleterList *_staticDeleters; 00178 00185 static void setActiveInstance(TDEInstance *d); 00186 static TDEInstance *activeInstance() { return _activeInstance; } 00187 00188 static TDEInstance *_activeInstance; 00189 }; 00190 00195 #define KMIN(a,b) kMin(a,b) 00196 00200 #define KMAX(a,b) kMax(a,b) 00201 00205 #define KABS(a) kAbs(a) 00206 00211 #define KCLAMP(x,low,high) kClamp(x,low,high) 00212 00213 // XXX KDE4: Make kMin, kMax and kClamp return "T" instead of "const T &"! 00214 template<class T> 00215 inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; } 00216 00217 template<class T> 00218 inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; } 00219 00220 template<class T> 00221 inline T kAbs (const T& a) { return a < 0 ? -a : a; } 00222 00223 template<class T> 00224 inline const T& kClamp( const T& x, const T& low, const T& high ) 00225 { 00226 if ( x < low ) return low; 00227 else if ( high < x ) return high; 00228 else return x; 00229 } 00230 00237 int TDECORE_EXPORT kasciistricmp( const char *str1, const char *str2 ); 00238 00239 00254 #endif // _TDEGLOBAL_H 00255