kjs Library API Documentation

array_object.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  *
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
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  *  $Id: array_object.h,v 1.16 2002/06/19 08:20:59 domi Exp $
00021  */
00022 
00023 #ifndef _ARRAY_OBJECT_H_
00024 #define _ARRAY_OBJECT_H_
00025 
00026 #include "internal.h"
00027 #include "function_object.h"
00028 
00029 namespace KJS {
00030 
00031   class ArrayInstanceImp : public ObjectImp {
00032   public:
00033     ArrayInstanceImp(const Object &proto);
00034 
00035     virtual void put(ExecState *exec, const UString &propertyName, const Value &value, int attr = None);
00036     virtual void putDirect(ExecState *exec, const UString &propertyName, const Value &value, int attr = None);
00041     virtual bool hasOwnProperty(ExecState *exec, const UString &propertyName);
00042 
00043     virtual const ClassInfo *classInfo() const { return &info; }
00044     static const ClassInfo info;
00045   };
00046 
00047  class ArrayPrototypeImp : public ArrayInstanceImp {
00048   public:
00049     ArrayPrototypeImp(ExecState *exec,
00050                       ObjectPrototypeImp *objProto);
00051     Value get(ExecState *exec, const UString &p) const;
00052     virtual const ClassInfo *classInfo() const { return &info; }
00053     static const ClassInfo info;
00054   };
00055 
00056   class ArrayProtoFuncImp : public InternalFunctionImp {
00057   public:
00058     ArrayProtoFuncImp(ExecState *exec, int i, int len);
00059 
00060     virtual bool implementsCall() const;
00061     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00062 
00063     enum { ToString, ToLocaleString, Concat, Join, Pop, Push,
00064        Reverse, Shift, Slice, Sort, Splice, UnShift };
00065   private:
00066     int id;
00067   };
00068 
00069   class ArrayObjectImp : public InternalFunctionImp {
00070   public:
00071     ArrayObjectImp(ExecState *exec,
00072                    FunctionPrototypeImp *funcProto,
00073                    ArrayPrototypeImp *arrayProto);
00074 
00075     virtual bool implementsConstruct() const;
00076     virtual Object construct(ExecState *exec, const List &args);
00077     virtual bool implementsCall() const;
00078     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00079 
00080   };
00081 
00082 }; // namespace
00083 
00084 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:14 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001