KJS-API
kjsprivate.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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