KJS-API
kjsprivate.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 KJSPRIVATE_H 00023 #define KJSPRIVATE_H 00024 00025 #include "kjs/ustring.h" 00026 #include "kjs/identifier.h" 00027 #include "kjs/list.h" 00028 #include <QtCore/QString> 00029 00030 #define JSVALUE_HANDLE(v) reinterpret_cast<KJSObjectHandle*>(v) 00031 #define JSVALUE(h) reinterpret_cast<KJS::JSValue*>((h)->hnd) 00032 00033 #define EXECSTATE_HANDLE(c) reinterpret_cast<KJSContextHandle*>(c) 00034 #define EXECSTATE(ctx) reinterpret_cast<ExecState*>((ctx)->hnd) 00035 00036 #define INTERPRETER_HANDLE(i) reinterpret_cast<KJSInterpreterHandle*>(i) 00037 #define INTERPRETER(h) reinterpret_cast<KJS::Interpreter*>((h)->hnd) 00038 00039 #define PROTOTYPE_HANDLE(p) reinterpret_cast<KJSPrototypeHandle*>(p) 00040 #define PROTOTYPE(h) reinterpret_cast<CustomPrototype*>((h)->hnd) 00041 00042 #define LIST_HANDLE(l) reinterpret_cast<const KJSArgumentsHandle*>(l) 00043 #define LIST(h) reinterpret_cast<const KJS::List*>((h)->hnd) 00044 00045 static inline KJS::UString toUString(const QString& s) 00046 { 00047 // ### can be done faster. see khtml/ecma/kjs_binding.cpp 00048 int l = s.length(); 00049 const KJS::UChar* u = reinterpret_cast<const KJS::UChar*>(s.unicode()); 00050 return KJS::UString(u, l); 00051 } 00052 00053 static inline KJS::Identifier toIdentifier(const QString& s) 00054 { 00055 int l = s.length(); 00056 const KJS::UChar* u = reinterpret_cast<const KJS::UChar*>(s.unicode()); 00057 return KJS::Identifier(u, l); 00058 } 00059 00060 static inline QString toQString(const KJS::UString& s) 00061 { 00062 int l = s.size(); 00063 const QChar* u = reinterpret_cast<const QChar*>(s.data()); 00064 return QString(u, l); 00065 } 00066 00067 #endif
KDE 4.6 API Reference