fix logic
[personal-kdelibs.git] / kjs / error_object.h
blob3e1ac8ae0850013e72368b53a46c95c58485a8fd
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)
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.
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.
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
22 #ifndef ERROR_OBJECT_H_
23 #define ERROR_OBJECT_H_
25 #include "function_object.h"
27 namespace KJS {
29 class ErrorInstance : public JSObject {
30 public:
31 ErrorInstance(JSObject *proto);
33 virtual const ClassInfo *classInfo() const { return &info; }
34 static const ClassInfo info;
37 class ErrorPrototype : public JSObject {
38 public:
39 ErrorPrototype(ExecState *exec,
40 ObjectPrototype *objectProto,
41 FunctionPrototype *funcProto);
44 class ErrorProtoFunc : public InternalFunctionImp {
45 public:
46 ErrorProtoFunc(ExecState*, FunctionPrototype*, const Identifier&);
47 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
50 class ErrorObjectImp : public InternalFunctionImp {
51 public:
52 ErrorObjectImp(ExecState *exec, FunctionPrototype *funcProto,
53 ErrorPrototype *errorProto);
55 virtual bool implementsConstruct() const;
56 virtual JSObject *construct(ExecState *exec, const List &args);
58 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
61 class NativeErrorPrototype : public JSObject {
62 public:
63 NativeErrorPrototype(ExecState *exec, ErrorPrototype *errorProto,
64 ErrorType et, UString name, UString message);
65 private:
66 ErrorType errType;
69 class NativeErrorImp : public InternalFunctionImp {
70 public:
71 NativeErrorImp(ExecState *exec, FunctionPrototype *funcProto,
72 JSObject *prot);
74 virtual bool implementsConstruct() const;
75 virtual JSObject *construct(ExecState *exec, const List &args);
76 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
78 virtual void mark();
80 virtual const ClassInfo *classInfo() const { return &info; }
81 static const ClassInfo info;
82 private:
83 JSObject *proto;
86 } // namespace
88 #endif