• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

kjsembed

  • kjsembed
  • kjsembed
binding_support.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
3 Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
4 Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
5 Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22
23#ifndef BINDING_SUPPORT_H
24#define BINDING_SUPPORT_H
25
26#include <QtCore/QDate>
27#include <QtCore/QStringList>
28
29#include <kjsembed/kjseglobal.h>
30#include <kjsembed/pointer.h>
31#include <kjs/object.h>
32#include <kdemacros.h>
33
34#define KJS_BINDING( NAME ) \
35class NAME \
36{ \
37 public: \
38 static const KJSEmbed::Method p_methods[]; \
39 static const KJSEmbed::Method p_statics[]; \
40 static const KJSEmbed::Enumerator p_enums[]; \
41 static const KJSEmbed::Constructor p_constructor; \
42 static KJS::JSObject *ctorMethod( KJS::ExecState *exec, const KJS::List &args );\
43 static const KJSEmbed::Enumerator *enums() { return p_enums;} \
44 static const KJSEmbed::Method *methods() { return p_methods;} \
45 static const KJSEmbed::Method *statics() { return p_statics;} \
46 static const KJSEmbed::Constructor *constructor() { return &p_constructor;} \
47 static const KJS::JSObject *construct(KJS::ExecState *exec, const KJS::List &args)\
48 { return (*p_constructor.construct)(exec,args); } \
49};
50
51#define KJSO_BINDING( NAME, TYPE, BASENAME ) \
52class KJSEMBED_EXPORT NAME : public BASENAME \
53{ \
54 public: \
55 NAME(KJS::ExecState *exec, TYPE * obj); \
56 static const KJSEmbed::Method p_methods[]; \
57 static const KJSEmbed::Method p_statics[]; \
58 static const KJSEmbed::Enumerator p_enums[]; \
59 static const KJSEmbed::Constructor p_constructor; \
60 static KJS::JSObject *bindMethod( KJS::ExecState *exec, PointerBase& ptrObj );\
61 static KJS::JSObject *ctorMethod( KJS::ExecState *exec, const KJS::List &args );\
62 static const KJSEmbed::Enumerator *enums() { return p_enums;} \
63 static const KJSEmbed::Method *methods() { return p_methods;} \
64 static const KJSEmbed::Method *statics() { return p_statics;} \
65 static const KJSEmbed::Constructor *constructor() { return &p_constructor;} \
66};
67
68
69#define KJSO_BINDING_NOEXP( NAME, TYPE, BASENAME ) \
70class NAME : public BASENAME \
71{ \
72 public: \
73 NAME(KJS::ExecState *exec, TYPE * obj); \
74 static const KJSEmbed::Method p_methods[]; \
75 static const KJSEmbed::Method p_statics[]; \
76 static const KJSEmbed::Enumerator p_enums[]; \
77 static const KJSEmbed::Constructor p_constructor; \
78 static KJS::JSObject *bindMethod( KJS::ExecState *exec, PointerBase& ptrObj );\
79 static KJS::JSObject *ctorMethod( KJS::ExecState *exec, const KJS::List &args );\
80 static const KJSEmbed::Enumerator *enums() { return p_enums;} \
81 static const KJSEmbed::Method *methods() { return p_methods;} \
82 static const KJSEmbed::Method *statics() { return p_statics;} \
83 static const KJSEmbed::Constructor *constructor() { return &p_constructor;} \
84};
85
86#define KJSO_VALUE_BINDING( NAME, TYPE, BASENAME ) \
87class KJSEMBED_EXPORT NAME : public BASENAME \
88{ \
89 public: \
90 NAME(KJS::ExecState *exec, const TYPE & val ); \
91 NAME(KJS::ExecState *exec, const char *typeName ); \
92 static const KJSEmbed::Method p_methods[]; \
93 static const KJSEmbed::Method p_statics[]; \
94 static const KJSEmbed::Enumerator p_enums[]; \
95 static const KJSEmbed::Constructor p_constructor; \
96 static KJS::JSObject *bindMethod( KJS::ExecState *exec, PointerBase& ptrObj );\
97 static KJS::JSObject *ctorMethod( KJS::ExecState *exec, const KJS::List &args );\
98 static const KJSEmbed::Enumerator *enums() { return p_enums;} \
99 static const KJSEmbed::Method *methods() { return p_methods;} \
100 static const KJSEmbed::Method *statics() { return p_statics;} \
101 static const KJSEmbed::Constructor *constructor() { return &p_constructor;} \
102};
103
104#define KJSO_START_BINDING_CTOR( NAME, TYPE, BASENAME ) \
105 NAME::NAME(KJS::ExecState *exec, TYPE * obj) \
106 : BASENAME( exec, obj ) \
107 { \
108 StaticBinding::publish( exec, this, NAME::methods() );
109
110#define KJSO_END_BINDING_CTOR \
111 }
112
113#define KJSO_SIMPLE_BINDING_CTOR( NAME, TYPE, BASENAME ) \
114 NAME::NAME(KJS::ExecState *exec, TYPE * obj) \
115 : BASENAME( exec, obj ) \
116 { \
117 StaticBinding::publish( exec, this, NAME::methods() ); \
118 }
119
120#define KJSV_SIMPLE_BINDING_CTOR( NAME, JSNAME, TYPE, BASENAME ) \
121 NAME::NAME(KJS::ExecState *exec, const TYPE & value) \
122 : BASENAME( exec, #JSNAME , value ) \
123 { \
124 StaticBinding::publish( exec, this, NAME::methods() ); \
125 }
126
127#define START_METHOD_LUT( TYPE ) \
128const Method TYPE::p_methods[] = \
129{
130
131#define START_STATIC_METHOD_LUT( TYPE ) \
132const Method TYPE::p_statics[] = \
133{
134
135#define END_METHOD_LUT \
136,{0, 0, 0, 0 }\
137};
138
139#define START_ENUM_LUT( TYPE) \
140const Enumerator TYPE::p_enums[] =\
141{
142
143#define END_ENUM_LUT \
144,{0, 0 }\
145};
146
147#define NO_ENUMS( TYPE ) \
148const Enumerator TYPE::p_enums[] = {{0, 0 }};
149
150#define NO_METHODS( TYPE )\
151const Method TYPE::p_methods[] = { {0, 0, 0, 0 } };
152
153#define NO_STATICS( TYPE )\
154const Method TYPE::p_statics[] = { {0, 0, 0, 0 } };
155
156
157#define START_CTOR( TYPE, JSNAME, ARGS )\
158const Constructor TYPE::p_constructor = \
159{ \
160#JSNAME, ARGS, KJS::DontDelete|KJS::ReadOnly, 0, &TYPE::ctorMethod, p_statics, p_enums, p_methods };\
161KJS::JSObject *TYPE::ctorMethod( KJS::ExecState *exec, const KJS::List &args )\
162{\
163 Q_UNUSED(exec);\
164 Q_UNUSED(args);
165
166#define END_CTOR \
167}
168
169#define KJSO_START_CTOR( TYPE, JSNAME, ARGS )\
170const Constructor TYPE::p_constructor = \
171{ \
172#JSNAME, ARGS, KJS::DontDelete|KJS::ReadOnly, &TYPE::bindMethod, &TYPE::ctorMethod, p_statics, p_enums, p_methods };\
173KJS::JSObject *TYPE::ctorMethod( KJS::ExecState *exec, const KJS::List &args )\
174{\
175 Q_UNUSED(exec);\
176 Q_UNUSED(args);
177
178#define KJSO_END_CTOR \
179}
180
181
182#define KJSO_START_BIND( NAME, TYPE )\
183KJS::JSObject *NAME::bindMethod( KJS::ExecState *exec, PointerBase& ptrObj )\
184{\
185 Q_UNUSED(exec);\
186 Q_UNUSED(ptrObj); \
187
188#define KJSO_END_BIND \
189}
190
191#define KJSO_QOBJECT_START_BIND( NAME, TYPE )\
192KJS::JSObject *NAME::bindMethod( KJS::ExecState *exec, PointerBase& ptrObj )\
193{\
194 Q_UNUSED(exec);\
195 QObject* qobj = pointer_cast<QObject>(&ptrObj); \
196 if (! qobj ) \
197 return 0; \
198 TYPE* object = qobject_cast<TYPE*>(qobj); \
199 if (! object ) \
200 return 0; \
201
202#define KJSO_QOBJECT_END_BIND \
203}
204
205#define KJSO_QOBJECT_BIND( NAME, TYPE )\
206KJS::JSObject *NAME::bindMethod( KJS::ExecState *exec, PointerBase& ptrObj )\
207{\
208 Q_UNUSED(exec);\
209 QObject* qobj = pointer_cast<QObject>(&ptrObj); \
210 if (! qobj ) \
211 return 0; \
212 TYPE* object = qobject_cast<TYPE*>(qobj); \
213 if (! object ) \
214 return 0; \
215 return new NAME(exec, object); \
216}
217
218#define KJSO_VALUE_START_BIND( NAME, TYPE )\
219KJS::JSObject *NAME::bindMethod( KJS::ExecState *exec, PointerBase& ptrObj )\
220{\
221 Q_UNUSED(exec);\
222 TYPE* object = pointer_cast<TYPE>(&ptrObj); \
223 if (! object ) \
224 return 0; \
225
226#define KJSO_VALUE_END_BIND \
227}
228
229#define KJSO_VALUE_BIND( NAME, TYPE )\
230KJS::JSObject *NAME::bindMethod( KJS::ExecState *exec, PointerBase& ptrObj )\
231{\
232 Q_UNUSED(exec);\
233 TYPE* object = pointer_cast<TYPE>(&ptrObj); \
234 if (! object ) \
235 return 0; \
236 return new NAME(exec, *object); \
237}
238
239namespace KJS
240{
241 inline JSObject* throwError(ExecState* e, ErrorType t, const QString& m)
242 { return throwError(e, t, KJSEmbed::toUString(m)); }
243}
244
245namespace KJSEmbed
246{
247 class KJSEMBED_EXPORT ProxyBinding : public KJS::JSObject
248 {
249 public:
250 ProxyBinding( KJS::ExecState *exec );
251 virtual ~ProxyBinding() {}
252
253 bool implementsCall() const { return true; }
254 bool implementsConstruct() const { return true; }
255 };
256
267 template <typename T>
268 T * extractBindingImp( KJS::ExecState *exec, KJS::JSValue *val)
269 {
270 return dynamic_cast<T*>(val->toObject(exec));
271 }
272
276 template <typename T>
277 T * extractBindingImp( KJS::JSObject *obj )
278 {
279 return dynamic_cast<T*>( obj );
280 }
281
289 typedef KJS::JSValue *(*callMethod)(KJS::ExecState*, KJS::JSObject *, const KJS::List&);
290
294 struct KJSEMBED_EXPORT Method
295 {
299 const char *name;
303 const int argc;
307 const int flags;
311 const callMethod call;
312 };
313
317 struct KJSEMBED_EXPORT Enumerator
318 {
322 const char *name;
326 const unsigned int value;
327 };
328
335 typedef KJS::JSObject *(*callBind)(KJS::ExecState*, PointerBase&);
336
343 typedef KJS::JSObject *(*callConstructor)(KJS::ExecState*, const KJS::List&);
344
345 struct KJSEMBED_EXPORT Constructor
346 {
351 const char *name;
355 const int argc;
359 const int flags;
363 const callBind bind;
367 const callConstructor construct;
371 const Method *staticMethods;
375 const Enumerator *enumerators;
379 const Method *methods;
380 };
381
386 QString KJSEMBED_EXPORT extractQString( KJS::ExecState *exec, const KJS::List &args, int idx, const QString defaultValue = QString() );
387
391 QString KJSEMBED_EXPORT extractQString( KJS::ExecState *exec, KJS::JSValue *value, const QString defaultValue = QString() );
392
396 KJS::JSValue* createQString( KJS::ExecState *exec, const QString &value );
397
402 QByteArray KJSEMBED_EXPORT extractQByteArray( KJS::ExecState *exec, const KJS::List &args, int idx, const QByteArray &defaultValue = QByteArray() );
403
407 QByteArray KJSEMBED_EXPORT extractQByteArray( KJS::ExecState *exec, KJS::JSValue *value, const QByteArray &defaultValue = QByteArray() );
408
412 KJS::JSValue* createQByteArray( KJS::ExecState *exec, const QByteArray &value );
413
414
415 template<typename T>
416 inline T KJSEMBED_EXPORT extractString(KJS::ExecState *exec, KJS::JSValue *value, T defaultValue = T())
417 {
418 if (!value || !value->isString())
419 return defaultValue;
420
421 return (T)(value->toString(exec).ascii());
422 }
423
424 template<typename T>
425 inline T KJSEMBED_EXPORT extractString(KJS::ExecState *exec, const KJS::List &args, int idx, T defaultValue = T())
426 {
427 if (args.size() >= idx)
428 return extractString<T>(exec, args[idx], defaultValue);
429 else
430 return defaultValue;
431 }
432
433
437 template<typename T>
438 inline T KJSEMBED_EXPORT extractNumber(KJS::ExecState *exec, KJS::JSValue *value, T defaultValue = T(0))
439 {
440 if (!value || !value->isNumber())
441 return defaultValue;
442
443 return static_cast<T>(value->toNumber(exec));
444 }
445
450 template<typename T>
451 inline T KJSEMBED_EXPORT extractNumber(KJS::ExecState *exec, const KJS::List &args, int idx, T defaultValue = T(0))
452 {
453 if( args.size() >= idx )
454 {
455 return extractNumber<T>( exec, args[idx], defaultValue );
456 }
457 else
458 return defaultValue;
459 }
460
464 template<typename T>
465 inline T KJSEMBED_EXPORT extractInteger(KJS::ExecState *exec, KJS::JSValue *value, T defaultValue)
466 {
467 if (!value || !value->isNumber())
468 return defaultValue;
469
470// deal with MSVC annoyances
471#if COMPILER(MSVC) || __GNUC__ == 3
472 return static_cast<T>(static_cast<int>(value->toInteger(exec)));
473#else
474 return static_cast<T>(value->toInteger(exec));
475#endif
476 }
477
478 // extractInteger specialization
479 template<>
480 inline qint32 KJSEMBED_EXPORT extractInteger<qint32>(KJS::ExecState *exec, KJS::JSValue *value, qint32 defaultValue)
481 {
482 if (!value || !value->isNumber())
483 return defaultValue;
484
485 return static_cast<qint32>(value->toInt32(exec));
486 }
487
488 // extractInteger specialization
489 template<>
490 inline quint32 KJSEMBED_EXPORT extractInteger<quint32>(KJS::ExecState *exec, KJS::JSValue *value, quint32 defaultValue)
491 {
492 if (!value || !value->isNumber())
493 return defaultValue;
494
495 return static_cast<quint32>(value->toUInt32(exec));
496 }
497
498 // extractInteger specialization
499 template<>
500 inline quint16 KJSEMBED_EXPORT extractInteger<quint16>(KJS::ExecState *exec, KJS::JSValue *value, quint16 defaultValue)
501 {
502 if (!value || !value->isNumber())
503 return defaultValue;
504
505 return static_cast<quint16>(value->toUInt16(exec));
506 }
507
512 template<typename T>
513 inline T KJSEMBED_EXPORT extractInteger(KJS::ExecState *exec, const KJS::List &args, int idx, T defaultValue = T(0))
514 {
515 if( args.size() >= idx )
516 {
517 return extractInteger<T>( exec, args[idx], defaultValue );
518 }
519 else
520 return defaultValue;
521 }
522
527 int KJSEMBED_EXPORT extractInt( KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue = 0 );
531 int KJSEMBED_EXPORT extractInt( KJS::ExecState *exec, KJS::JSValue *value, int defaultValue = 0 );
535 KJS::JSValue* createInt( KJS::ExecState *exec, int value );
536
541 double KJSEMBED_EXPORT extractDouble( KJS::ExecState *exec, const KJS::List &args, int idx, double defaultValue = 0 );
545 double KJSEMBED_EXPORT extractDouble( KJS::ExecState *exec, KJS::JSValue *value, double defaultValue = 0 );
549 KJS::JSValue* createDouble( KJS::ExecState *exec, double value );
550
555 float KJSEMBED_EXPORT extractFloat( KJS::ExecState *exec, const KJS::List &args, int idx, float defaultValue = 0 );
559 float KJSEMBED_EXPORT extractFloat( KJS::ExecState *exec, KJS::JSValue *value, float defaultValue = 0 );
563 KJS::JSValue* createFloat( KJS::ExecState *exec, float value );
564
569 bool KJSEMBED_EXPORT extractBool( KJS::ExecState *exec, const KJS::List &args, int idx, bool defaultValue = false );
573 bool extractBool( KJS::ExecState *exec, KJS::JSValue *value, bool defaultValue = false );
577 KJS::JSValue* createBool( KJS::ExecState *exec, bool value );
578
583 QDateTime KJSEMBED_EXPORT extractQDateTime( KJS::ExecState *exec, const KJS::List &args, int idx, const QDateTime &defaultValue = QDateTime() );
587 QDateTime KJSEMBED_EXPORT extractQDateTime( KJS::ExecState *exec, KJS::JSValue *value, const QDateTime &defaultValue = QDateTime() );
591 KJS::JSValue* createQDateTime( KJS::ExecState *exec, const QDateTime &value );
592
597 QDate KJSEMBED_EXPORT extractQDate( KJS::ExecState *exec, const KJS::List &args, int idx, const QDate &defaultValue = QDate() );
601 QDate KJSEMBED_EXPORT extractQDate( KJS::ExecState *exec, KJS::JSValue *value, const QDate &defaultValue = QDate() );
605 KJS::JSValue* createQDate( KJS::ExecState *exec, const QDate &value );
606
611 QTime KJSEMBED_EXPORT extractQTime( KJS::ExecState *exec, const KJS::List &args, int idx, const QTime &defaultValue = QTime() );
615 QTime KJSEMBED_EXPORT extractQTime( KJS::ExecState *exec, KJS::JSValue *value, const QTime &defaultValue = QTime() );
619 KJS::JSValue* createQTime( KJS::ExecState *exec, const QTime &value );
620
625 QStringList KJSEMBED_EXPORT extractQStringList( KJS::ExecState *exec, const KJS::List &args, int idx, const QStringList &defaultValue = QStringList() );
629 QStringList KJSEMBED_EXPORT extractQStringList( KJS::ExecState *exec, KJS::JSValue *value, const QStringList &defaultValue = QStringList() );
633 KJS::JSValue* createQStringList( KJS::ExecState *exec, const QStringList &value );
634
635}
636
637#endif
638//kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
KJSEmbed::ProxyBinding
Definition: binding_support.h:248
KJSEmbed::ProxyBinding::implementsCall
bool implementsCall() const
Definition: binding_support.h:253
KJSEmbed::ProxyBinding::implementsConstruct
bool implementsConstruct() const
Definition: binding_support.h:254
KJSEmbed::ProxyBinding::~ProxyBinding
virtual ~ProxyBinding()
Definition: binding_support.h:251
kjseglobal.h
KJSEMBED_EXPORT
#define KJSEMBED_EXPORT
Definition: kjseglobal.h:32
KJSEmbed
Definition: application.h:33
KJSEmbed::callConstructor
KJS::JSObject *(* callConstructor)(KJS::ExecState *, const KJS::List &)
Constructor signature.
Definition: binding_support.h:343
KJSEmbed::createQByteArray
KJS::JSValue * createQByteArray(KJS::ExecState *exec, const QByteArray &value)
Create a new KJS::JSValue with the value of the QString.
Definition: binding_support.cpp:66
KJSEmbed::createQDate
KJS::JSValue * createQDate(KJS::ExecState *exec, const QDate &value)
Create a new KJS::JSValue with the value of the QDate.
Definition: binding_support.cpp:205
KJSEmbed::createQStringList
KJS::JSValue * createQStringList(KJS::ExecState *exec, const QStringList &value)
Create a new KJS::JSValue with the value of the QStringList.
Definition: binding_support.cpp:243
KJSEmbed::extractQString
QString KJSEMBED_EXPORT extractQString(KJS::ExecState *exec, const KJS::List &args, int idx, const QString defaultValue=QString())
Extracts a QString from an argument list.
Definition: binding_support.cpp:34
KJSEmbed::createQTime
KJS::JSValue * createQTime(KJS::ExecState *exec, const QTime &value)
Create a new KJS::JSValue with the value of the QTime.
Definition: binding_support.cpp:224
KJSEmbed::callBind
KJS::JSObject *(* callBind)(KJS::ExecState *, PointerBase &)
Bind signature.
Definition: binding_support.h:335
KJSEmbed::createBool
KJS::JSValue * createBool(KJS::ExecState *exec, bool value)
Create a new KJS::JSValue with the value of the bool.
Definition: binding_support.cpp:167
KJSEmbed::extractInt
int KJSEMBED_EXPORT extractInt(KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue=0)
Extracts an integer from an argument list.
Definition: binding_support.cpp:72
KJSEmbed::extractInteger
T KJSEMBED_EXPORT extractInteger(KJS::ExecState *exec, KJS::JSValue *value, T defaultValue)
Extract an integer from a value.
Definition: binding_support.h:465
KJSEmbed::extractBool
bool KJSEMBED_EXPORT extractBool(KJS::ExecState *exec, const KJS::List &args, int idx, bool defaultValue=false)
Extracts a bool from an argument list.
Definition: binding_support.cpp:149
KJSEmbed::extractInteger< quint16 >
quint16 KJSEMBED_EXPORT extractInteger< quint16 >(KJS::ExecState *exec, KJS::JSValue *value, quint16 defaultValue)
Definition: binding_support.h:500
KJSEmbed::createQString
KJS::JSValue * createQString(KJS::ExecState *exec, const QString &value)
Create a new KJS::JSValue with the value of the QString.
Definition: binding_support.cpp:88
KJSEmbed::extractQStringList
QStringList KJSEMBED_EXPORT extractQStringList(KJS::ExecState *exec, const KJS::List &args, int idx, const QStringList &defaultValue=QStringList())
Extracts a QStringList from an argument list.
Definition: binding_support.cpp:231
KJSEmbed::extractNumber
T KJSEMBED_EXPORT extractNumber(KJS::ExecState *exec, KJS::JSValue *value, T defaultValue=T(0))
Extract a number from a value.
Definition: binding_support.h:438
KJSEmbed::extractQByteArray
QByteArray KJSEMBED_EXPORT extractQByteArray(KJS::ExecState *exec, const KJS::List &args, int idx, const QByteArray &defaultValue=QByteArray())
Extracts a QByteArray from an argument list.
Definition: binding_support.cpp:50
KJSEmbed::createFloat
KJS::JSValue * createFloat(KJS::ExecState *exec, float value)
Create a new KJS::JSValue with the value of the float.
Definition: binding_support.cpp:142
KJSEmbed::extractString
T KJSEMBED_EXPORT extractString(KJS::ExecState *exec, KJS::JSValue *value, T defaultValue=T())
Definition: binding_support.h:416
KJSEmbed::createDouble
KJS::JSValue * createDouble(KJS::ExecState *exec, double value)
Create a new KJS::JSValue with the value of the double.
Definition: binding_support.cpp:117
KJSEmbed::extractFloat
float KJSEMBED_EXPORT extractFloat(KJS::ExecState *exec, const KJS::List &args, int idx, float defaultValue=0)
Extracts a float from an argument list.
Definition: binding_support.cpp:124
KJSEmbed::extractInteger< qint32 >
qint32 KJSEMBED_EXPORT extractInteger< qint32 >(KJS::ExecState *exec, KJS::JSValue *value, qint32 defaultValue)
Definition: binding_support.h:480
KJSEmbed::createInt
KJS::JSValue * createInt(KJS::ExecState *exec, int value)
Create a new KJS::JSValue with the value of the integer.
Definition: binding_support.cpp:94
KJSEmbed::extractQTime
QTime KJSEMBED_EXPORT extractQTime(KJS::ExecState *exec, const KJS::List &args, int idx, const QTime &defaultValue=QTime())
Extracts a QTime from an argument list.
Definition: binding_support.cpp:212
KJSEmbed::toUString
KJS::UString toUString(const QString &qs)
Definition: kjseglobal.h:66
KJSEmbed::extractQDate
QDate KJSEMBED_EXPORT extractQDate(KJS::ExecState *exec, const KJS::List &args, int idx, const QDate &defaultValue=QDate())
Extracts a QDate from an argument list.
Definition: binding_support.cpp:193
KJSEmbed::callMethod
KJS::JSValue *(* callMethod)(KJS::ExecState *, KJS::JSObject *, const KJS::List &)
Method callback signature.
Definition: binding_support.h:289
KJSEmbed::createQDateTime
KJS::JSValue * createQDateTime(KJS::ExecState *exec, const QDateTime &value)
Create a new KJS::JSValue with the value of the QDateTime.
Definition: binding_support.cpp:186
KJSEmbed::extractBindingImp
T * extractBindingImp(KJS::ExecState *exec, KJS::JSValue *val)
This will extract a binding implementation from a KJS::JSValue.
Definition: binding_support.h:268
KJSEmbed::extractInteger< quint32 >
quint32 KJSEMBED_EXPORT extractInteger< quint32 >(KJS::ExecState *exec, KJS::JSValue *value, quint32 defaultValue)
Definition: binding_support.h:490
KJSEmbed::extractQDateTime
QDateTime KJSEMBED_EXPORT extractQDateTime(KJS::ExecState *exec, const KJS::List &args, int idx, const QDateTime &defaultValue=QDateTime())
Extracts a QDateTime from an argument list.
Definition: binding_support.cpp:174
KJSEmbed::extractDouble
double KJSEMBED_EXPORT extractDouble(KJS::ExecState *exec, const KJS::List &args, int idx, double defaultValue=0)
Extracts a double from an argument list.
Definition: binding_support.cpp:100
KJS
Implement QString-KJS::UString conversion methods.
Definition: kjs_object_model.h:29
KJS::throwError
JSObject * throwError(ExecState *e, ErrorType t, const QString &m)
Definition: binding_support.h:241
pointer.h
value
QVariant value
Definition: settings.cpp:35
KJSEmbed::Constructor
Definition: binding_support.h:346
KJSEmbed::Constructor::argc
const int argc
Number of arguments.
Definition: binding_support.h:355
KJSEmbed::Constructor::staticMethods
const Method * staticMethods
Static methods on the object.
Definition: binding_support.h:371
KJSEmbed::Constructor::bind
const callBind bind
The callback for the constructor.
Definition: binding_support.h:363
KJSEmbed::Constructor::name
const char * name
The constructor name as it will appear in Javascript.
Definition: binding_support.h:351
KJSEmbed::Constructor::construct
const callConstructor construct
The callback for the constructor.
Definition: binding_support.h:367
KJSEmbed::Constructor::enumerators
const Enumerator * enumerators
Enumerators for the object.
Definition: binding_support.h:375
KJSEmbed::Constructor::flags
const int flags
Flags for the member properties.
Definition: binding_support.h:359
KJSEmbed::Constructor::methods
const Method * methods
Member methods for the object.
Definition: binding_support.h:379
KJSEmbed::Enumerator
Enumerator structure.
Definition: binding_support.h:318
KJSEmbed::Enumerator::name
const char * name
Method name as will appear in javascript.
Definition: binding_support.h:322
KJSEmbed::Enumerator::value
const unsigned int value
Integer value.
Definition: binding_support.h:326
KJSEmbed::Method
Method structure.
Definition: binding_support.h:295
KJSEmbed::Method::argc
const int argc
Number of arguments.
Definition: binding_support.h:303
KJSEmbed::Method::flags
const int flags
Flags for the member properties.
Definition: binding_support.h:307
KJSEmbed::Method::call
const callMethod call
The callback for the method.
Definition: binding_support.h:311
KJSEmbed::Method::name
const char * name
Method name as will appear in javascript.
Definition: binding_support.h:299
PointerBase
Definition: pointer.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kjsembed

Skip menu "kjsembed"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal