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 ERROR_OBJECT_H_
23#define ERROR_OBJECT_H_
24
25#include "function_object.h"
26
27namespace KJS {
28
29 class ErrorInstance : public JSObject {
30 public:
31 ErrorInstance(JSObject *proto);
32
33 virtual const ClassInfo *classInfo() const { return &info; }
34 static const ClassInfo info;
35 };
36
37 class ErrorPrototype : public ErrorInstance {
38 public:
39 ErrorPrototype(ExecState *exec,
40 ObjectPrototype *objectProto,
41 FunctionPrototype *funcProto);
42 };
43
44 class ErrorProtoFunc : public InternalFunctionImp {
45 public:
46 ErrorProtoFunc(ExecState*, FunctionPrototype*, const Identifier&);
47 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
48 };
49
50 class ErrorObjectImp : public InternalFunctionImp {
51 public:
52 ErrorObjectImp(ExecState *exec, FunctionPrototype *funcProto,
53 ErrorPrototype *errorProto);
54
55 virtual bool implementsConstruct() const;
56 using KJS::JSObject::construct;
57 virtual JSObject *construct(ExecState *exec, const List &args);
58
59 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
60 };
61
62 class NativeErrorPrototype : public JSObject {
63 public:
64 NativeErrorPrototype(ExecState *exec, ErrorPrototype *errorProto,
65 ErrorType et, UString name, UString message);
66 private:
67 ErrorType errType;
68 };
69
70 class NativeErrorImp : public InternalFunctionImp {
71 public:
72 NativeErrorImp(ExecState *exec, FunctionPrototype *funcProto,
73 JSObject *prot);
74
75 virtual bool implementsConstruct() const;
76 using KJS::JSObject::construct;
77 virtual JSObject *construct(ExecState *exec, const List &args);
78 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
79
80 virtual void mark();
81
82 virtual const ClassInfo *classInfo() const { return &info; }
83 static const ClassInfo info;
84 private:
85 JSObject *proto;
86 };
87
88} // namespace
89
90#endif
91