~ubuntu-branches/ubuntu/maverick/webkit/maverick

« back to all changes in this revision

Viewing changes to JavaScriptCore/kjs/array_object.h

  • Committer: Bazaar Package Importer
  • Author(s): Mike Hommey
  • Date: 2007-08-19 15:54:12 UTC
  • Revision ID: james.westby@ubuntu.com-20070819155412-uxxg1h9plpghmtbi
Tags: upstream-0~svn25144
ImportĀ upstreamĀ versionĀ 0~svn25144

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c-basic-offset: 2 -*-
 
2
/*
 
3
 *  This file is part of the KDE libraries
 
4
 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
 
5
 *
 
6
 *  This library is free software; you can redistribute it and/or
 
7
 *  modify it under the terms of the GNU Lesser General Public
 
8
 *  License as published by the Free Software Foundation; either
 
9
 *  version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 *  This library is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 *  Lesser General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU Lesser General Public
 
17
 *  License along with this library; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 *
 
20
 */
 
21
 
 
22
#ifndef ARRAY_OBJECT_H_
 
23
#define ARRAY_OBJECT_H_
 
24
 
 
25
#include "array_instance.h"
 
26
#include "function_object.h"
 
27
 
 
28
namespace KJS {
 
29
 
 
30
 class ArrayPrototype : public ArrayInstance {
 
31
  public:
 
32
    ArrayPrototype(ExecState *exec,
 
33
                      ObjectPrototype *objProto);
 
34
    bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
 
35
    virtual const ClassInfo *classInfo() const { return &info; }
 
36
    static const ClassInfo info;
 
37
  };
 
38
 
 
39
  class ArrayProtoFunc : public InternalFunctionImp {
 
40
  public:
 
41
    ArrayProtoFunc(ExecState *exec, int i, int len, const Identifier& name);
 
42
 
 
43
    virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
 
44
 
 
45
    enum { ToString, ToLocaleString, Concat, Join, Pop, Push,
 
46
          Reverse, Shift, Slice, Sort, Splice, UnShift, 
 
47
          Every, ForEach, Some, IndexOf, Filter, Map, LastIndexOf };
 
48
  private:
 
49
    int id;
 
50
  };
 
51
 
 
52
  const unsigned MAX_ARRAY_INDEX = 0xFFFFFFFEu;
 
53
 
 
54
  class ArrayObjectImp : public InternalFunctionImp {
 
55
  public:
 
56
    ArrayObjectImp(ExecState *exec,
 
57
                   FunctionPrototype *funcProto,
 
58
                   ArrayPrototype *arrayProto);
 
59
 
 
60
    virtual bool implementsConstruct() const;
 
61
    virtual JSObject *construct(ExecState *exec, const List &args);
 
62
    virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
 
63
 
 
64
  };
 
65
 
 
66
} // namespace
 
67
 
 
68
#endif