# kjs Library API Documentation

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

# property_map.h

    00001 // -*- c-basic-offset: 2 -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    00005  *
    00006  *  This library is free software; you can redistribute it and/or
    00007  *  modify it under the terms of the GNU Lesser 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  *  Lesser General Public License for more details.
    00015  *
    00016  *  You should have received a copy of the GNU Lesser 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  *  $Id: property_map.h,v 1.8.2.1 2003/05/17 11:19:25 mueller Exp $
    00022  */
    00023
    00024
    00025 #ifndef _KJS_PROPERTY_MAP_H_
    00026 #define _KJS_PROPERTY_MAP_H_
    00027
    00028 #include "ustring.h"
    00029 #include "value.h"
    00030
    00031 namespace KJS {
    00032
    00033   class PropertyMapNode {
    00034   public:
    00035     PropertyMapNode(const UString &n, ValueImp *v, int att, PropertyMapNode *p)
    00036       : name(n), value(v), attr(att), left(0), right(0), parent(p), height(1) {}
    00037
    00038     UString name;
    00039     ValueImp *value;
    00040     int attr;
    00041
    00042     void setLeft(PropertyMapNode *newLeft);
    00043     void setRight(PropertyMapNode *newRight);
    00044     PropertyMapNode *findMax();
    00045     PropertyMapNode *findMin();
    00046
    00047     PropertyMapNode *next();
    00048
    00049     PropertyMapNode *left;
    00050     PropertyMapNode *right;
    00051     PropertyMapNode *parent;
    00052     int height;
    00053
    00054   private:
    00055     void setParent(PropertyMapNode *newParent);
    00056   };
    00057
    00069   class PropertyMap {
    00070   public:
    00071     PropertyMap();
    00072     ~PropertyMap();
    00073
    00074     void put(const UString &name, ValueImp *value, int attr);
    00075     void remove(const UString &name);
    00076     ValueImp *get(const UString &name) const;
    00077
    00078     void clear(PropertyMapNode *node = 0);
    00079     void dump(const PropertyMapNode *node = 0, int indent = 0) const;
    00080     void checkTree(const PropertyMapNode *node = 0) const;
    00081
    00082     PropertyMapNode *getNode(const UString &name) const;
    00083     PropertyMapNode *first() const;
    00084
    00085   private:
    00086
    00087     PropertyMapNode *remove(PropertyMapNode *node);
    00088     void balance(PropertyMapNode* node);
    00089     void updateHeight(PropertyMapNode* &node);
    00090
    00091     void rotateRR(PropertyMapNode* &node);
    00092     void rotateLL(PropertyMapNode* &node);
    00093     void rotateRL(PropertyMapNode* &node);
    00094     void rotateLR(PropertyMapNode* &node);
    00095
    00096     PropertyMapNode *root;
    00097   };
    00098
    00099   int uscompare(const UString &s1, const UString &s2);
    00100
    00101 } // namespace
    00102
    00103 #endif // _KJS_PROPERTY_MAP_H_

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 13:08:34 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001