# kdecore Library API Documentation

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

# kconfigdata.h

    00001 /*
    00002    This file is part of the KDE libraries
    00003    Copyright (c) 1999-2000 Preston Brown <pbrown@kde.org>
    00004    Copyright (C) 1996-2000 Matthias Kalle Dalheimer <kalle@kde.org>
    00005
    00006    This library is free software; you can redistribute it and/or
    00007    modify it under the terms of the GNU Library General Public
    00008    License as published by the Free Software Foundation; either
    00009    version 2 of the License, or (at your option) any later version.
    00010
    00011    This library is distributed in the hope that it will be useful,
    00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014    Library General Public License for more details.
    00015
    00016    You should have received a copy of the GNU Library General Public License
    00017    along with this library; see the file COPYING.LIB.  If not, write to
    00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019    Boston, MA 02111-1307, USA.
    00020 */
    00021
    00022 #ifndef _KCONFIGDATA_H
    00023 #define _KCONFIGDATA_H
    00024
    00025 #include <qmap.h> // generic red-black tree class
    00026
    00031 struct KEntry
    00032 {
    00033   KEntry()
    00034     : mValue(0), bDirty(false), bNLS(false),
    00035       bGlobal(false), bImmutable(false), bDeleted(false), bExpand(false) {}
    00036   QCString mValue;
    00037   bool    bDirty :1;  // must the entry be written back to disk?
    00038   bool    bNLS   :1;  // entry should be written with locale tag
    00039   bool    bGlobal:1;  // entry should be written to the global config file
    00040   bool    bImmutable:1; // Entry can not be modified
    00041   bool    bDeleted:1; // Entry has been deleted
    00042   bool    bExpand:1;  // Whether to apply dollar expansion
    00043 };
    00044
    00050 struct KEntryKey
    00051 {
    00052   KEntryKey(const QCString& _group = 0,
    00053             const QCString& _key = 0)
    00054       : mGroup(_group), mKey(_key), bLocal(false), bDefault(false),
    00055         c_key(_key.data()) {}
    00056   QCString mGroup; // the "group" to which this EntryKey belongs
    00057   QCString mKey;   // the _actual_ key of the entry in question
    00058   bool    bLocal  :1; // Entry is localised
    00059   bool    bDefault:1; // Entry indicates default value
    00060
    00061   const char *c_key;
    00062 };
    00063
    00068 inline bool operator <(const KEntryKey &k1, const KEntryKey &k2)
    00069 {
    00070    //saves one strcmp on each call
    00071    int result=qstrcmp(k1.mGroup.data(),k2.mGroup.data());
    00072    if (result!=0)
    00073       return (result<0);
    00074
    00075   if (!k1.c_key && k2.c_key)
    00076     return true;
    00077
    00078   result = 0;
    00079   if (k1.c_key && k2.c_key)
    00080      result = strcmp(k1.c_key, k2.c_key);
    00081   if (result != 0)
    00082      return result < 0;
    00083   if (!k1.bLocal && k2.bLocal)
    00084     return true;
    00085   if (k1.bLocal && !k2.bLocal)
    00086     return false;
    00087   return (!k1.bDefault && k2.bDefault);
    00088 }
    00089
    00096 typedef QMap<KEntryKey, KEntry> KEntryMap;
    00097
    00102 typedef QMap<KEntryKey, KEntry>::Iterator KEntryMapIterator;
    00103
    00110 typedef QMap<KEntryKey, KEntry>::ConstIterator KEntryMapConstIterator;
    00111
    00112 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:24 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001