#ifndef ARRAY_OBJECT_H_
#define ARRAY_OBJECT_H_
#include "array_instance.h"
#include "function_object.h"
namespace KJS {
class ArrayPrototype : public ArrayInstance {
public:
ArrayPrototype(ExecState *exec,
ObjectPrototype *objProto);
bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
};
class ArrayProtoFunc : public InternalFunctionImp {
public:
ArrayProtoFunc(ExecState *exec, int i, int len, const Identifier& name);
virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
enum { ToString, ToLocaleString, Concat, Join, Pop, Push,
Reverse, Shift, Slice, Sort, Splice, UnShift,
Every, ForEach, Some, IndexOf, Filter, Map };
private:
int id;
};
const unsigned MAX_ARRAY_INDEX = 0xFFFFFFFEu;
class ArrayObjectImp : public InternalFunctionImp {
public:
ArrayObjectImp(ExecState *exec,
FunctionPrototype *funcProto,
ArrayPrototype *arrayProto);
virtual bool implementsConstruct() const;
virtual JSObject *construct(ExecState *exec, const List &args);
virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
};
}
#endif