KJSEmbed
KJSEmbed Namespace Reference
Typedef Documentation
| typedef KJS::JSObject*(* KJSEmbed::callBind)(KJS::ExecState *, PointerBase &) |
Bind signature.
- exec - the execution context
- ptr - A PointerBase that points to a Pointer object that contains a pointer to the object to provide a javascript binding for.
Definition at line 335 of file binding_support.h.
| typedef KJS::JSObject*(* KJSEmbed::callConstructor)(KJS::ExecState *, const KJS::List &) |
Constructor signature.
- exec - the execution context
- args - A KJS::List of KJS::JSValue objects that represents the arguments that where passed in from the javascript function signature.
Definition at line 343 of file binding_support.h.
| typedef KJS::JSValue*(* KJSEmbed::callMethod)(KJS::ExecState *, KJS::JSObject *, const KJS::List &) |
Method callback signature.
- exec - The execution state.
- object - The current object that the method is working on (equivelent of "this")
- args - A KJS::List of KJS::JSValue objects that represents the arguments that where passed in from the javascript function signature.
Definition at line 289 of file binding_support.h.
Function Documentation
| KJSO_END_BINDING_CTOR return new KJSEmbed::ApplicationBinding | ( | exec | , | |
| ::qobject_cast< QApplication * > | (QCoreApplication::instance()) | |||
| ) |
| QTextStream * KJSEmbed::conerr | ( | ) |
Definition at line 172 of file kjseglobal.cpp.
| QTextStream * KJSEmbed::conin | ( | ) |
Definition at line 147 of file kjseglobal.cpp.
| QTextStream * KJSEmbed::conout | ( | ) |
Definition at line 159 of file kjseglobal.cpp.
| QList< QVariant > KJSEmbed::convertArrayToList | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value | |||
| ) |
Convert a KJS::JSValue into a QList.
If the list contains only strings, or objects that can be converted to strings you can call to convertArrayToStringList. If you call this on an associative array or a javascript object the list will return empty. Unless there happens to be a property with a numeric index present, then all bets are off.
Definition at line 169 of file variant_binding.cpp.
| QMap< QString, QVariant > KJSEmbed::convertArrayToMap | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value | |||
| ) |
Convert a KJS::JSValue that contains an associative array into a QMap.
If you call this on a normal Javascript object you will get each property as the key and its data as the value. A normal array will give you a QMap with each key being the index.
Definition at line 153 of file variant_binding.cpp.
| QStringList KJSEmbed::convertArrayToStringList | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value | |||
| ) |
Convert a KJS::JSValue inot a QStringList.
- See also:
- convertArrayToList.
Definition at line 199 of file variant_binding.cpp.
| KJS::JSValue * KJSEmbed::convertToValue | ( | KJS::ExecState * | exec, | |
| const QVariant & | value | |||
| ) |
Convert a QVariant to a KJS::JSValue.
If the type is a known type the bindings will be added. If the type is supported by QVariant, but is not supported by KJSEmbed then it will just be wrapped. This wrapped value can be used just like normal value bindings, save for the lack of methods available to the object.
Definition at line 319 of file variant_binding.cpp.
| QVariant KJSEmbed::convertToVariant | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value | |||
| ) |
| KJSO_END_BINDING_CTOR return new KJSEmbed::CoreApplicationBinding | ( | exec | , | |
| QCoreApplication:: | instance() | |||
| ) |
| KJS::JSValue * KJSEmbed::createBool | ( | KJS::ExecState * | exec, | |
| bool | value | |||
| ) |
Create a new KJS::JSValue with the value of the bool.
Definition at line 167 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createDouble | ( | KJS::ExecState * | exec, | |
| double | value | |||
| ) |
Create a new KJS::JSValue with the value of the double.
Definition at line 117 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createFloat | ( | KJS::ExecState * | exec, | |
| float | value | |||
| ) |
Create a new KJS::JSValue with the value of the float.
Definition at line 142 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createInt | ( | KJS::ExecState * | exec, | |
| int | value | |||
| ) |
Create a new KJS::JSValue with the value of the integer.
Definition at line 94 of file binding_support.cpp.
| KJS::JSValue* KJSEmbed::createObject | ( | KJS::ExecState * | exec, | |
| const KJS::UString & | className, | |||
| const T * | value, | |||
| KJSEmbed::ObjectBinding::Ownership | owner = KJSEmbed::ObjectBinding::JSOwned | |||
| ) | [inline] |
Can create any known KJSEmbed::ObjectBinding object and set the value.
On failure a KJS::jsNull will be returned and the exception set.
Definition at line 200 of file object_binding.h.
| KJS::JSValue * KJSEmbed::createQByteArray | ( | KJS::ExecState * | exec, | |
| const QByteArray & | value | |||
| ) |
Create a new KJS::JSValue with the value of the QString.
Definition at line 66 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createQDate | ( | KJS::ExecState * | , | |
| const QDate & | ||||
| ) |
Create a new KJS::JSValue with the value of the QDate.
Definition at line 205 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createQDateTime | ( | KJS::ExecState * | , | |
| const QDateTime & | ||||
| ) |
Create a new KJS::JSValue with the value of the QDateTime.
Definition at line 186 of file binding_support.cpp.
| KJS::JSObject * KJSEmbed::createQObject | ( | KJS::ExecState * | exec, | |
| QObject * | value, | |||
| KJSEmbed::ObjectBinding::Ownership | owner = KJSEmbed::ObjectBinding::JSOwned | |||
| ) |
Returns a binding object for the specified QObject.
This method walks up the meta objects in order to find the most specific binding it can. There should always be some kind of binding possible even if it is just the QObject binding.
- Parameters:
-
exec Represents the current state of script execution. value The QObject or from it inherited instance we should return a binding object for. owner Defines who's the owner of the QObject. This could be; - CPPOwned what means, that the QObject's lifetime is handled within C++ code. So, we just provide access to it and don't take any future actions.
- QObjOwned means that the QObject got deleted if the parent QObject is destroyed. If the QObject has no parent QObject, it behaves like JSOwned.
- JSOwned means, that the returned KJS::JSObject takes care of deleting the QObject. This means, that the QObject got deleted as soon as the KJS::JSObject got destroyed what happens if the KJS::JSObject is not needed / in use any longer.
- Returns:
- the binding object instance that wraps the QObject instance or a JSObject with a prototype of jsNull (that is, the ECMAScript "null" value, not a null object pointer) if we failed to provide any binding for it.
Definition at line 703 of file qobject_binding.cpp.
| KJS::JSValue * KJSEmbed::createQString | ( | KJS::ExecState * | exec, | |
| const QString & | value | |||
| ) |
Create a new KJS::JSValue with the value of the QString.
Definition at line 88 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createQStringList | ( | KJS::ExecState * | , | |
| const QStringList & | ||||
| ) |
Create a new KJS::JSValue with the value of the QStringList.
Definition at line 243 of file binding_support.cpp.
| KJS::JSValue * KJSEmbed::createQTime | ( | KJS::ExecState * | , | |
| const QTime & | ||||
| ) |
Create a new KJS::JSValue with the value of the QTime.
Definition at line 224 of file binding_support.cpp.
| KJS::JSValue* KJSEmbed::createValue | ( | KJS::ExecState * | exec, | |
| const KJS::UString & | className, | |||
| const T & | value | |||
| ) | [inline] |
Definition at line 195 of file value_binding.h.
| KJS::JSValue* KJSEmbed::createVariant | ( | KJS::ExecState * | exec, | |
| const KJS::UString & | className, | |||
| const T & | value | |||
| ) | [inline] |
Can create any known KJSEmbed::VariantBinding object and set the value.
On failure a KJS::jsNull will be returned and the exception set. Only values that are supported by QVariant will work.
Definition at line 184 of file variant_binding.h.
| return new KJSEmbed::DomDocumentBinding | ( | exec | , | |
| QDomDocument(name) | ||||
| ) |
| return new KJSEmbed::DomTextBinding | ( | exec | , | |
| QDomText() | ||||
| ) |
| T* KJSEmbed::extractBindingImp | ( | KJS::JSObject * | obj | ) | [inline] |
This is just a helper function similar to the one above, only it takes a KJS::JSObject.
Definition at line 277 of file binding_support.h.
| T* KJSEmbed::extractBindingImp | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | val | |||
| ) | [inline] |
This will extract a binding implementation from a KJS::JSValue.
KJSEmbed ObjectBindingImp *imp = extractBindingImp<ObjectBindingImp>(exec,val); if( imp ) qDebug("it worked"); else qDebug("it failed");
Definition at line 268 of file binding_support.h.
| bool KJSEmbed::extractBool | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value, | |||
| bool | defaultValue = false | |||
| ) |
Extract a bool from a value.
If the value cannot convert to a bool the defaultValue is returned.
Definition at line 159 of file binding_support.cpp.
| bool KJSEmbed::extractBool | ( | KJS::ExecState * | exec, | |
| const KJS::List & | args, | |||
| int | idx, | |||
| bool | defaultValue = false | |||
| ) |
Extracts a bool from an argument list.
If the argument is not present, or is not convertable to a bool the defaultValue is returned.
Definition at line 149 of file binding_support.cpp.
| double KJSEmbed::extractDouble | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value, | |||
| double | defaultValue = 0 | |||
| ) |
Extract a double from a value.
If the value cannot convert to a double the defaultValue is returned.
Definition at line 109 of file binding_support.cpp.
| double KJSEmbed::extractDouble | ( | KJS::ExecState * | exec, | |
| const KJS::List & | args, | |||
| int | idx, | |||
| double | defaultValue = 0 | |||
| ) |
Extracts a double from an argument list.
If the argument is not present, or is not convertable to a double the defaultValue is returned.
Definition at line 100 of file binding_support.cpp.
| float KJSEmbed::extractFloat | ( | KJS::ExecState * | exec, | |
| KJS::JSValue * | value, | |||
| float | defaultValue = 0 | |||
| ) |
Extract a float from a value.
If the value cannot convert to a float the defaultValue is returned.
Definition at line 134 of file binding_support.cpp.
| float KJSEmbed::extractFloat | ( | KJS::ExecState * |
KDE 4.0 API Reference