# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 "kdelibs_export.h"
    00022 #include <kinstance.h> // KDE4: class KInstance is enough here
    00023
    00024 class KCharsets;
    00025 class KConfig;
    00026 class KSharedConfig;
    00027 class KIconLoader;
    00028 class KLocale;
    00029 class KStandardDirs;
    00030 class KStaticDeleterBase;
    00031 class KStaticDeleterList;
    00032 class KStringDict;
    00033 class QString;
    00034
    00044 class KDECORE_EXPORT KGlobal
    00045 {
    00046 public:
    00047
    00054     static KInstance            *instance();
    00055
    00060     static KStandardDirs    *dirs();
    00061
    00066     static KConfig      *config();
    00067
    00072     static KSharedConfig        *sharedConfig();
    00073
    00078     static KIconLoader          *iconLoader();
    00079
    00084     static KLocale              *locale();
    00085
    00090     static KCharsets            *charsets();
    00091
    00109     static const QString        &staticQString(const char *str);
    00110
    00128     static const QString        &staticQString(const QString &str);
    00129
    00136     static void registerStaticDeleter(KStaticDeleterBase *d);
    00137
    00144     static void unregisterStaticDeleter(KStaticDeleterBase *d);
    00145
    00152     static void deleteStaticDeleters();
    00153
    00154     //private:
    00155     static  KStringDict         *_stringDict;
    00156     static  KInstance           *_instance;
    00157     static  KLocale             *_locale;
    00158     static  KCharsets           *_charsets;
    00159     static  KStaticDeleterList  *_staticDeleters;
    00160
    00167     static void setActiveInstance(KInstance *d);
    00168     static KInstance *activeInstance() { return _activeInstance; }
    00169
    00170     static  KInstance           *_activeInstance;
    00171 };
    00172
    00177 #define KMIN(a,b)   kMin(a,b)
    00178
    00182 #define KMAX(a,b)   kMax(a,b)
    00183
    00187 #define KABS(a) kAbs(a)
    00188
    00193 #define KCLAMP(x,low,high) kClamp(x,low,high)
    00194
    00195 // XXX KDE4: Make kMin, kMax and kClamp return "T" instead of "const T &"!
    00196 template<class T>
    00197 inline const T& kMin (const T& a, const T& b) { return a < b ? a : b; }
    00198
    00199 template<class T>
    00200 inline const T& kMax (const T& a, const T& b) { return b < a ? a : b; }
    00201
    00202 template<class T>
    00203 inline T kAbs (const T& a) { return a < 0 ? -a : a; }
    00204
    00205 template<class T>
    00206 inline const T& kClamp( const T& x, const T& low, const T& high )
    00207 {
    00208     if ( x < low )       return low;
    00209     else if ( high < x ) return high;
    00210     else                 return x;
    00211 }
    00212
    00219 int KDECORE_EXPORT kasciistricmp( const char *str1, const char *str2 );
    00220
    00221
    00236 #endif // _KGLOBAL_H
    00237

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:04 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003