array_instance.h
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
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 } 
00070 
00071 #endif
 
This file is part of the documentation for kjs Library Version 3.2.0.