# kjs Library API Documentation

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

# array_instance.h

    00001 // -*- c-basic-offset: 2 -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    00005  *  Copyright (C) 2003 Apple Computer, Inc.
    00006  *
    00007  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU Lesser General Public
    00009  *  License as published by the Free Software Foundation; either
    00010  *  version 2 of the License, or (at your option) any later version.
    00011  *
    00012  *  This library is distributed in the hope that it will be useful,
    00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  *  Lesser General Public License for more details.
    00016  *
    00017  *  You should have received a copy of the GNU Lesser General Public
    00018  *  License along with this library; if not, write to the Free Software
    00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00020  *
    00021  */
    00022
    00023 #ifndef ARRAY_INSTANCE_H
    00024 #define ARRAY_INSTANCE_H
    00025
    00026 #include "object.h"
    00027
    00028 namespace KJS {
    00029
    00030   class ArrayInstanceImp : public ObjectImp {
    00031   public:
    00032     ArrayInstanceImp(ObjectImp *proto, unsigned initialLength);
    00033     ArrayInstanceImp(ObjectImp *proto, const List &initialValues);
    00034     ~ArrayInstanceImp();
    00035
    00036     virtual Value get(ExecState *exec, const Identifier &propertyName) const;
    00037     virtual Value getPropertyByIndex(ExecState *exec, unsigned propertyName) const;
    00038     virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
    00039     virtual void putPropertyByIndex(ExecState *exec, unsigned propertyName, const Value &value, int attr = None);
    00040     virtual bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
    00041     virtual bool hasPropertyByIndex(ExecState *exec, unsigned propertyName) const;
    00042     virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
    00043     virtual bool deletePropertyByIndex(ExecState *exec, unsigned propertyName);
    00044     virtual ReferenceList propList(ExecState *exec, bool recursive);
    00045
    00046     virtual void mark();
    00047
    00048     virtual const ClassInfo *classInfo() const { return &info; }
    00049     static const ClassInfo info;
    00050
    00051     unsigned getLength() const { return length; }
    00052
    00053     void sort(ExecState *exec);
    00054     void sort(ExecState *exec, Object &compareFunction);
    00055
    00056   private:
    00057     void setLength(unsigned newLength, ExecState *exec);
    00058
    00059     unsigned pushUndefinedObjectsToEnd(ExecState *exec);
    00060
    00061     void resizeStorage(unsigned);
    00062
    00063     unsigned length;
    00064     unsigned storageLength;
    00065     unsigned capacity;
    00066     ValueImp **storage;
    00067   };
    00068
    00069 } // namespace KJS
    00070
    00071 #endif

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