KJS-API
kjsprototype.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (C) 2008 Harri Porten (porten@kde.org) 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 * 00020 */ 00021 00022 #ifndef KJSPROTOTYPE_H 00023 #define KJSPROTOTYPE_H 00024 00025 #include "kjsapi_export.h" 00026 #include "kjscontext.h" 00027 00028 class KJSInterpreter; 00029 class KJSArguments; 00030 class KJSGlobalObject; 00031 class KJSPrototypeHandle; 00032 00038 class KJSAPI_EXPORT KJSPrototype 00039 { 00040 public: 00045 KJSPrototype(); 00049 ~KJSPrototype(); 00053 void defineConstant(const QString& name, double value); 00059 void defineConstant(const QString& name, const QString& value); 00065 void defineConstant(const QString& name, const KJSObject& value); 00070 typedef KJSObject (*PropertyGetter)(KJSContext* context, void* object); 00075 typedef void (*PropertySetter)(KJSContext* context, void* object, 00076 KJSObject value); 00082 void defineProperty(KJSContext* ctx, 00083 const QString& name, 00084 PropertyGetter getter, 00085 PropertySetter setter = 0); 00086 00092 typedef KJSObject (*FunctionCall)(KJSContext* context, void* object, 00093 const KJSArguments& arguments); 00094 00099 void defineFunction(KJSContext* ctx, 00100 const QString& name, FunctionCall callback); 00101 00102 #if 0 00103 00107 void defineFinalization(FinalizeFunction callback); 00108 #endif 00109 00118 KJSObject constructObject(KJSContext* ctx, void *internalValue = 0); 00119 00124 KJSGlobalObject constructGlobalObject(void *internalValue = 0); 00125 00126 private: 00127 KJSPrototype(const KJSPrototype&); // undefined 00128 KJSPrototype& operator=(const KJSPrototype&); // undefined 00129 00130 KJSPrototypeHandle* hnd; 00131 }; 00132 00133 #endif
KDE 4.6 API Reference