40 #include <QtCore/qstringlist.h> 41 #include <QtCore/qmetaobject.h> 45 #include "CodeBlock.h" 47 #include "Interpreter.h" 49 #include "ExceptionHelpers.h" 50 #include "PrototypeFunction.h" 51 #include "InitializeThreading.h" 52 #include "ObjectPrototype.h" 53 #include "SourceCode.h" 54 #include "FunctionPrototype.h" 55 #include "TimeoutChecker.h" 56 #include "JSFunction.h" 58 #include "PropertyNameArray.h" 59 #include "Operations.h" 70 #include <QtCore/qcoreapplication.h> 71 #include <QtCore/qdir.h> 72 #include <QtCore/qfile.h> 73 #include <QtCore/qfileinfo.h> 74 #include <QtCore/qpluginloader.h> 75 #include <QtCore/qset.h> 76 #include <QtCore/qtextstream.h> 376 n = ::fmod(sign * ::floor(abs_n), D32);
377 const double D31 = D32 / 2.0;
379 if (sign == -1 && n < -D31)
382 else if (sign != -1 && n >= D31)
396 n = ::fmod(sign * ::floor(abs_n), D32);
406 static const qsreal D16 = 65536.0;
414 n = ::fmod(sign * ::floor(abs_n), D16);
430 int sign = n < 0 ? -1 : 1;
431 return sign * ::floor(::fabs(n));
439 return JSC::UString::from(value);
444 return ((JSC::UString)value).toDouble();
453 int r = int(::fmod(t, MsPerSecond));
454 return (r >= 0) ? r : r + int(MsPerSecond);
468 JSC::GregorianDateTime
tm;
469 JSC::msToGregorianDateTime(exec, t,
true, tm);
490 JSC::GregorianDateTime
tm;
491 tm.year = date.
year() - 1900;
492 tm.month = date.
month() - 1;
493 tm.monthDay = date.
day();
496 tm.hour = time.
hour();
497 tm.minute = time.
minute();
498 tm.second = time.
second();
499 return JSC::gregorianDateTimeToMS(exec, tm, time.
msec(),
true);
502 void GlobalClientData::mark(JSC::MarkStack& markStack)
504 engine->mark(markStack);
511 :
JSC::TimeoutChecker(originalChecker)
512 , m_shouldProcessEvents(false)
513 , m_shouldAbortEvaluation(false)
522 if (JSC::TimeoutChecker::didTimeOut(exec))
525 if (m_shouldProcessEvents)
528 return m_shouldAbortEvaluation;
538 if ((c >=
'0') && (c <=
'9'))
540 else if ((c >=
'a') && (c <=
'z'))
542 else if ((c >=
'A') && (c <=
'Z'))
556 }
else if (buf[0] ==
'-') {
561 if (((size-i) >= 2) && (buf[i] ==
'0')) {
562 if (((buf[i+1] ==
'x') || (buf[i+1] ==
'X'))
564 if ((radix != 0) && (radix != 16))
574 }
else if (radix == 0) {
579 for ( ; i < size; ++i) {
581 if ((d == -1) || (d >= radix))
593 for (--i ; i >= j; --i, multiplier *= radix)
594 result +=
toDigit(buf[i]) * multiplier;
608 if (!value || !value.isObject())
610 JSC::CallData callData;
611 return (JSC::asObject(value)->getCallData(callData) != JSC::CallTypeNone);
614 static JSC::JSValue JSC_HOST_CALL
functionConnect(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
615 static JSC::JSValue JSC_HOST_CALL
functionDisconnect(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
617 JSC::JSValue JSC_HOST_CALL
functionDisconnect(JSC::ExecState *exec, JSC::JSObject * , JSC::JSValue thisObject,
const JSC::ArgList &args)
619 #ifndef QT_NO_QOBJECT 620 if (args.size() == 0) {
621 return JSC::throwError(exec, JSC::GeneralError,
"Function.prototype.disconnect: no arguments given");
625 return JSC::throwError(exec, JSC::TypeError,
"Function.prototype.disconnect: this object is not a signal");
632 return JSC::throwError(exec, JSC::TypeError,
"Function.prototype.discconnect: cannot disconnect from deleted QObject");
640 return JSC::throwError(exec, JSC::TypeError, message);
645 JSC::JSValue receiver;
647 JSC::JSValue arg0 = args.at(0);
648 if (args.size() < 2) {
652 JSC::JSValue arg1 = args.at(1);
663 return JSC::throwError(exec, JSC::TypeError,
"Function.prototype.disconnect: target is not a function");
671 return JSC::throwError(exec, JSC::GeneralError, message);
673 return JSC::jsUndefined();
678 #endif // QT_NO_QOBJECT 681 JSC::JSValue JSC_HOST_CALL
functionConnect(JSC::ExecState *exec, JSC::JSObject * , JSC::JSValue thisObject,
const JSC::ArgList &args)
683 #ifndef QT_NO_QOBJECT 684 if (args.size() == 0) {
685 return JSC::throwError(exec, JSC::GeneralError,
"Function.prototype.connect: no arguments given");
689 return JSC::throwError(exec, JSC::TypeError,
"Function.prototype.connect: this object is not a signal");
696 return JSC::throwError(exec, JSC::TypeError,
"Function.prototype.connect: cannot connect to deleted QObject");
704 return JSC::throwError(exec, JSC::TypeError, message);
715 for (
int i = 0; i < overloads.
size(); ++i) {
721 return JSC::throwError(exec, JSC::GeneralError, message);
727 JSC::JSValue receiver;
729 JSC::JSValue arg0 = args.at(0);
730 if (args.size() < 2) {
734 JSC::JSValue arg1 = args.at(1);
745 return JSC::throwError(exec, JSC::TypeError,
"Function.prototype.connect: target is not a function");
753 return JSC::throwError(exec, JSC::GeneralError, message);
755 return JSC::jsUndefined();
761 #endif // QT_NO_QOBJECT 764 static JSC::JSValue JSC_HOST_CALL
functionPrint(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
765 static JSC::JSValue JSC_HOST_CALL
functionGC(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
766 static JSC::JSValue JSC_HOST_CALL
functionVersion(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
768 JSC::JSValue JSC_HOST_CALL
functionPrint(JSC::ExecState* exec, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList& args)
771 for (
unsigned i = 0; i < args.size(); ++i) {
774 QString s(args.at(i).toString(exec));
775 if (exec->hadException())
779 if (exec->hadException())
780 return exec->exception();
782 return JSC::jsUndefined();
785 JSC::JSValue JSC_HOST_CALL
functionGC(JSC::ExecState* exec, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&)
789 return JSC::jsUndefined();
792 JSC::JSValue JSC_HOST_CALL
functionVersion(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&)
794 return JSC::JSValue(exec, 1);
797 #ifndef QT_NO_TRANSLATION 799 static JSC::JSValue JSC_HOST_CALL
functionQsTranslate(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
800 static JSC::JSValue JSC_HOST_CALL
functionQsTranslateNoOp(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
801 static JSC::JSValue JSC_HOST_CALL
functionQsTr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
802 static JSC::JSValue JSC_HOST_CALL
functionQsTrNoOp(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
803 static JSC::JSValue JSC_HOST_CALL
functionQsTrId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
804 static JSC::JSValue JSC_HOST_CALL
functionQsTrIdNoOp(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
806 JSC::JSValue JSC_HOST_CALL
functionQsTranslate(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList &args)
809 return JSC::throwError(exec, JSC::GeneralError,
"qsTranslate() requires at least two arguments");
810 if (!args.at(0).isString())
811 return JSC::throwError(exec, JSC::GeneralError,
"qsTranslate(): first argument (context) must be a string");
812 if (!args.at(1).isString())
813 return JSC::throwError(exec, JSC::GeneralError,
"qsTranslate(): second argument (text) must be a string");
814 if ((args.size() > 2) && !args.at(2).isString())
815 return JSC::throwError(exec, JSC::GeneralError,
"qsTranslate(): third argument (comment) must be a string");
816 if ((args.size() > 3) && !args.at(3).isString())
817 return JSC::throwError(exec, JSC::GeneralError,
"qsTranslate(): fourth argument (encoding) must be a string");
818 if ((args.size() > 4) && !args.at(4).isNumber())
819 return JSC::throwError(exec, JSC::GeneralError,
"qsTranslate(): fifth argument (n) must be a number");
820 #ifndef QT_NO_QOBJECT 821 JSC::UString context = args.at(0).toString(exec);
823 JSC::UString
text = args.at(1).toString(exec);
824 #ifndef QT_NO_QOBJECT 825 JSC::UString comment;
827 comment = args.at(2).toString(exec);
829 if (args.size() > 3) {
830 JSC::UString encStr = args.at(3).toString(exec);
831 if (encStr ==
"CodecForTr")
833 else if (encStr ==
"UnicodeUTF8")
836 return JSC::throwError(exec, JSC::GeneralError,
QString::fromLatin1(
"qsTranslate(): invalid encoding '%0'").arg(encStr));
840 n = args.at(4).toInt32(exec);
843 #ifndef QT_NO_QOBJECT 845 text.UTF8String().c_str(),
846 comment.UTF8String().c_str(),
851 return JSC::jsString(exec, result);
857 return JSC::jsUndefined();
861 JSC::JSValue JSC_HOST_CALL
functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList &args)
864 return JSC::throwError(exec, JSC::GeneralError,
"qsTr() requires at least one argument");
865 if (!args.at(0).isString())
866 return JSC::throwError(exec, JSC::GeneralError,
"qsTr(): first argument (text) must be a string");
867 if ((args.size() > 1) && !args.at(1).isString())
868 return JSC::throwError(exec, JSC::GeneralError,
"qsTr(): second argument (comment) must be a string");
869 if ((args.size() > 2) && !args.at(2).isNumber())
870 return JSC::throwError(exec, JSC::GeneralError,
"qsTr(): third argument (n) must be a number");
871 #ifndef QT_NO_QOBJECT 873 JSC::UString context;
876 JSC::ExecState *frame = exec->callerFrame()->removeHostCallFrameFlag();
879 && frame->codeBlock()->source()
880 && !frame->codeBlock()->source()->url().isEmpty()) {
884 frame = frame->callerFrame()->removeHostCallFrameFlag();
888 JSC::UString
text = args.at(0).toString(exec);
889 #ifndef QT_NO_QOBJECT 890 JSC::UString comment;
892 comment = args.at(1).toString(exec);
895 n = args.at(2).toInt32(exec);
898 #ifndef QT_NO_QOBJECT 900 text.UTF8String().c_str(),
901 comment.UTF8String().c_str(),
906 return JSC::jsString(exec, result);
909 JSC::JSValue JSC_HOST_CALL
functionQsTrNoOp(JSC::ExecState *, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList &args)
912 return JSC::jsUndefined();
916 JSC::JSValue JSC_HOST_CALL
functionQsTrId(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList &args)
919 return JSC::throwError(exec, JSC::GeneralError,
"qsTrId() requires at least one argument");
920 if (!args.at(0).isString())
921 return JSC::throwError(exec, JSC::TypeError,
"qsTrId(): first argument (id) must be a string");
922 if ((args.size() > 1) && !args.at(1).isNumber())
923 return JSC::throwError(exec, JSC::TypeError,
"qsTrId(): second argument (n) must be a number");
924 JSC::UString
id = args.at(0).toString(exec);
927 n = args.at(1).toInt32(exec);
928 return JSC::jsString(exec,
qtTrId(
id.UTF8String().c_str(), n));
931 JSC::JSValue JSC_HOST_CALL
functionQsTrIdNoOp(JSC::ExecState *, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList &args)
934 return JSC::jsUndefined();
937 #endif // QT_NO_TRANSLATION 939 static JSC::JSValue JSC_HOST_CALL
stringProtoFuncArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue,
const JSC::ArgList&);
941 JSC::JSValue JSC_HOST_CALL
stringProtoFuncArg(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue thisObject,
const JSC::ArgList &args)
943 QString value(thisObject.toString(exec));
944 JSC::JSValue arg = (args.size() != 0) ? args.
at(0) : JSC::jsUndefined();
947 result = value.
arg(arg.toString(exec));
948 else if (arg.isNumber())
949 result = value.
arg(arg.toNumber(exec));
950 return JSC::jsString(exec, result);
954 #if !defined(QT_NO_QOBJECT) && !defined(QT_NO_LIBRARY) 960 for (
int i = 0; i < components.
count(); ++i) {
976 : originalGlobalObjectProxy(0), currentFrame(0),
977 qobjectPrototype(0), qmetaobjectPrototype(0), variantPrototype(0),
978 activeAgent(0), agentLineNumber(-1),
979 registeredScriptValues(0), freeScriptValues(0), freeScriptValuesCount(0),
980 registeredScriptStrings(0), processEventsInterval(-1), inEval(false)
982 qMetaTypeId<QScriptValue>();
983 qMetaTypeId<QList<int> >();
984 #ifndef QT_NO_QOBJECT 985 qMetaTypeId<QObjectList>();
989 qFatal(
"QScriptEngine: Must construct a Q(Core)Application before a QScriptEngine");
992 JSC::initializeThreading();
993 JSC::IdentifierTable *oldTable = JSC::currentIdentifierTable();
998 JSC::ExecState* exec = globalObject->globalExec();
1012 globalObject->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, globalObject->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"print"),
QScript::functionPrint));
1013 globalObject->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, globalObject->prototypeFunctionStructure(), 0, JSC::Identifier(exec,
"gc"),
QScript::functionGC));
1014 globalObject->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, globalObject->prototypeFunctionStructure(), 0, JSC::Identifier(exec,
"version"),
QScript::functionVersion));
1017 globalObject->functionPrototype()->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, globalObject->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"disconnect"),
QScript::functionDisconnect));
1018 globalObject->functionPrototype()->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, globalObject->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"connect"),
QScript::functionConnect));
1020 JSC::TimeoutChecker* originalChecker =
globalData->timeoutChecker;
1022 delete originalChecker;
1028 JSC::setCurrentIdentifierTable(oldTable);
1038 it.
value()->disconnectFromEngine();
1073 return QVariant(targetType, *reinterpret_cast<void* *>(v.
data()));
1082 for (
int i = 0; i < lst.
size(); ++i)
1091 for (
uint i = 0; i < len; ++i)
1099 for (
int i = 0; i < lst.
size(); ++i)
1112 for (
uint i = 0; i < len; ++i)
1120 JSC::JSValue obj = JSC::constructEmptyObject(exec);
1133 JSC::PropertyNameArray propertyNames(exec);
1134 obj->getOwnPropertyNames(exec, propertyNames, JSC::IncludeDontEnumProperties);
1136 JSC::PropertyNameArray::const_iterator
it = propertyNames.begin();
1137 for( ; it != propertyNames.end(); ++
it)
1147 return JSC::JSValue();
1202 glob->setPrototype(object->prototype());
1218 if (!value || !value.isObject() || !JSC::asObject(value)->isGlobalObject())
1233 if (frame->codeBlock() != 0) {
1234 return frame->thisValue();
1235 }
else if(frame == frame->lexicalGlobalObject()->globalExec()) {
1236 return frame->globalThisValue();
1239 return thisRegister->jsValue();
1246 return frame->registers() - JSC::RegisterFile::CallFrameHeaderSize - frame->argumentCount();
1262 if (exec->codeBlock())
1265 return exec->returnValueRegister();
1271 exec->registers()[JSC::RegisterFile::ReturnValueRegister] = JSC::Register::withInt(flags);
1304 if ((*it)->prototype)
1305 markStack.append((*it)->prototype);
1314 JSC::ScopeChainIterator
it(node);
1315 for (it = node->begin(); it != node->end(); ++
it) {
1316 JSC::JSObject *
object = *
it;
1318 markStack.append(
object);
1325 #ifndef QT_NO_QOBJECT 1331 qdata->
mark(markStack);
1351 globalData->heap.reportExtraMemoryCost(size);
1369 JSC::EvalExecutable *executable,
1374 q->currentContext()->activationObject();
1378 debugger->evaluateStart(sourceId);
1380 q->clearExceptions();
1381 JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject);
1383 if (compile && !executable->isCompiled()) {
1384 JSC::JSObject*
error = executable->compile(exec, exec->scopeChain());
1387 exec->setException(error);
1390 debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId,
false);
1391 debugger->evaluateStop(error, sourceId);
1399 JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull())
1400 ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
1401 JSC::JSValue exceptionValue;
1406 JSC::JSValue result = exec->interpreter()->execute(executable, exec, thisObject, exec->scopeChain(), &exceptionValue);
1418 if (exceptionValue) {
1419 exec->setException(exceptionValue);
1422 debugger->evaluateStop(exceptionValue, sourceId);
1424 return exceptionValue;
1428 debugger->evaluateStop(result, sourceId);
1434 #ifndef QT_NO_QOBJECT 1438 const QScriptEngine::QObjectWrapOptions &options)
1441 return JSC::jsNull();
1445 QScriptEngine::QObjectWrapOptions opt = options & ~
QScriptEngine::PreferExistingWrapperObject;
1447 if (preferExisting) {
1465 result->setPrototype(proto);
1479 return JSC::jsNull();
1492 int start = targetType.
startsWith(
"const ") ? 6 : 0;
1494 if (
void *instance = qobject->qt_metacast(className)) {
1542 emit q->signalHandlerException(q->uncaughtException());
1546 JSC::JSValue receiver, JSC::JSValue
function,
1555 return scriptConnect(sender, index, receiver,
function, JSC::JSValue(), type);
1559 JSC::JSValue receiver, JSC::JSValue
function)
1571 JSC::JSValue receiver, JSC::JSValue
function,
1572 JSC::JSValue senderWrapper,
1576 return data->
addSignalHandler(sender, signalIndex, receiver,
function, senderWrapper, type);
1580 JSC::JSValue receiver, JSC::JSValue
function)
1597 JSC::JSValue
function)
1610 (*it)->detachFromEngine();
1640 #ifndef QT_NO_REGEXP 1646 JSC::JSValue buf[2];
1647 JSC::ArgList args(buf,
sizeof(buf));
1653 int len = pattern.
length();
1657 bool inBracket =
false;
1671 ecmaPattern += wc[i++];
1683 pattern = ecmaPattern;
1686 JSC::UString jscPattern = pattern;
1690 JSC::UString jscFlags = flags;
1691 buf[0] = JSC::jsString(exec, jscPattern);
1692 buf[1] = JSC::jsString(exec, jscFlags);
1693 return JSC::constructRegExp(exec, args);
1700 JSC::JSValue buf[2];
1701 JSC::ArgList args(buf,
sizeof(buf));
1702 JSC::UString jscPattern = pattern;
1710 JSC::UString jscFlags = strippedFlags;
1711 buf[0] = JSC::jsString(exec, jscPattern);
1712 buf[1] = JSC::jsString(exec, jscFlags);
1713 return JSC::constructRegExp(exec, args);
1722 obj->setPrototype(proto);
1731 JSC::JSObject *jscObject = JSC::asObject(objectValue);
1733 qWarning(
"QScriptEngine::newVariant(): changing class of non-QScriptObject not supported");
1734 return JSC::JSValue();
1745 #ifndef QT_NO_REGEXP 1767 #ifndef QT_NO_QOBJECT 1773 #ifndef QT_NO_REGEXP 1782 }
else if (value.isInt32()) {
1784 }
else if (value.isDouble()) {
1786 }
else if (value.isString()) {
1788 }
else if (value.isBoolean()) {
1796 JSC::JSValue result;
1799 JSC::JSObject *
object = JSC::asObject(value);
1800 JSC::PropertySlot slot(
object);
1801 if (object->getOwnPropertySlot(exec,
id, slot))
1802 result = slot.getValue(exec,
id);
1808 result =
property(exec, scope,
id, resolveMode);
1815 JSC::JSValue result;
1818 JSC::JSObject *
object = JSC::asObject(value);
1819 JSC::PropertySlot slot(
object);
1820 if (object->getOwnPropertySlot(exec, index, slot))
1821 result = slot.getValue(exec, index);
1829 JSC::JSObject *thisObject = JSC::asObject(objectValue);
1830 JSC::JSValue setter = thisObject->lookupSetter(exec,
id);
1831 JSC::JSValue getter = thisObject->lookupGetter(exec,
id);
1835 if ((flags & QScriptValue::PropertyGetter) && (flags & QScriptValue::PropertySetter)) {
1837 thisObject->deleteProperty(exec,
id);
1838 }
else if (flags & QScriptValue::PropertyGetter) {
1840 thisObject->deleteProperty(exec,
id);
1841 if (setter && setter.isObject())
1842 thisObject->defineSetter(exec,
id, JSC::asObject(setter));
1845 thisObject->deleteProperty(exec,
id);
1846 if (getter && getter.isObject())
1847 thisObject->defineGetter(exec,
id, JSC::asObject(getter));
1850 if (value.isObject()) {
1852 if (
id == exec->propertyNames().underscoreProto) {
1853 qWarning(
"QScriptValue::setProperty() failed: " 1854 "cannot set getter or setter of native property `__proto__'");
1856 if (flags & QScriptValue::PropertyGetter)
1857 thisObject->defineGetter(exec,
id, JSC::asObject(value));
1858 if (flags & QScriptValue::PropertySetter)
1859 thisObject->defineSetter(exec,
id, JSC::asObject(value));
1862 qWarning(
"QScriptValue::setProperty(): getter/setter must be a function");
1867 if (getter && getter.isObject() && !(setter && setter.isObject())) {
1868 qWarning(
"QScriptValue::setProperty() failed: " 1869 "property '%s' has a getter but no setter",
1875 thisObject->deleteProperty(exec,
id);
1877 if (thisObject->hasOwnProperty(exec,
id))
1878 thisObject->deleteProperty(exec,
id);
1881 JSC::PutPropertySlot slot;
1882 thisObject->put(exec,
id, value, slot);
1891 JSC::asObject(objectValue)->deleteProperty(exec, index);
1896 setProperty(exec, objectValue, JSC::Identifier::from(exec, index), value, flags);
1901 unsigned attribs = 0;
1903 attribs |= JSC::ReadOnly;
1905 attribs |= JSC::DontEnum;
1907 attribs |= JSC::DontDelete;
1909 JSC::asObject(objectValue)->putWithAttributes(exec, index, value, attribs);
1911 JSC::asObject(objectValue)->put(exec, index, value);
1918 const QScriptValue::ResolveFlags &mode)
1920 JSC::JSObject *
object = JSC::asObject(value);
1921 unsigned attribs = 0;
1922 JSC::PropertyDescriptor descriptor;
1923 if (object->getOwnPropertyDescriptor(exec,
id, descriptor))
1924 attribs = descriptor.attributes();
1927 JSC::JSValue proto =
object->prototype();
1933 if (attribs & JSC::ReadOnly)
1935 if (attribs & JSC::DontEnum)
1937 if (attribs & JSC::DontDelete)
1940 if (attribs & JSC::Getter || !object->lookupGetter(exec,
id).isUndefinedOrNull())
1942 if (attribs & JSC::Setter || !object->lookupSetter(exec,
id).isUndefinedOrNull())
1944 #ifndef QT_NO_QOBJECT 1961 #ifdef QT_NO_QOBJECT 1966 d_ptr->q_ptr =
this;
1974 d_ptr->q_ptr =
this;
2014 #ifdef QT_NO_QOBJECT 2034 JSC::JSObject *result =
d->globalObject();
2056 if (!
object.isObject())
2059 JSC::JSObject *jscObject = JSC::asObject(
d->scriptValueToJSCValue(
object));
2060 d->setGlobalObject(jscObject);
2071 return d->scriptValueFromJSCValue(JSC::jsNull());
2082 return d->scriptValueFromJSCValue(JSC::jsUndefined());
2116 JSC::ExecState* exec =
d->currentFrame;
2126 #ifndef QT_NO_REGEXP 2138 return d->scriptValueFromJSCValue(
d->newRegExp(
d->currentFrame, regexp));
2141 #endif // QT_NO_REGEXP 2157 return d->scriptValueFromJSCValue(
d->newVariant(value));
2194 JSC::JSValue jsObject =
d->scriptValueToJSCValue(
object);
2195 return d->scriptValueFromJSCValue(
d->newVariant(jsObject, value));
2198 #ifndef QT_NO_QOBJECT 2222 const QObjectWrapOptions &options)
2226 JSC::JSValue jscQObject =
d->newQObject(
object, ownership, options);
2227 return d->scriptValueFromJSCValue(jscQObject);
2263 const QObjectWrapOptions &options)
2267 return newQObject(qtObject, ownership, options);
2271 qWarning(
"QScriptEngine::newQObject(): changing class of non-QScriptObject not supported");
2283 return scriptObject;
2286 #endif // QT_NO_QOBJECT 2300 return d->scriptValueFromJSCValue(
d->newObject());
2325 JSC::ExecState* exec =
d->currentFrame;
2328 QScriptValue scriptObject =
d->scriptValueFromJSCValue(result);
2333 return scriptObject;
2341 qWarning(
"QScriptEngine::newActivationObject() not implemented");
2393 JSC::ExecState* exec =
d->currentFrame;
2411 JSC::ExecState* exec =
d->currentFrame;
2430 return d->scriptValueFromJSCValue(
d->newArray(
d->currentFrame, length));
2444 return d->scriptValueFromJSCValue(
d->newRegExp(
d->currentFrame, pattern, flags));
2456 return d->scriptValueFromJSCValue(
d->newDate(
d->currentFrame, value));
2468 return d->scriptValueFromJSCValue(
d->newDate(
d->currentFrame, value));
2471 #ifndef QT_NO_QOBJECT 2492 JSC::JSValue jscCtor =
d->scriptValueToJSCValue(ctor);
2493 JSC::JSValue jscQMetaObject =
d->newQMetaObject(metaObject, jscCtor);
2494 return d->scriptValueFromJSCValue(jscQMetaObject);
2531 #endif // QT_NO_QOBJECT 2624 switch (result.
state) {
2675 WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
2677 intptr_t sourceId = provider->asID();
2678 JSC::SourceCode source(provider, lineNumber);
2680 JSC::ExecState* exec =
d->currentFrame;
2682 bool compile =
true;
2683 return d->scriptValueFromJSCValue(
d->evaluateHelper(exec, sourceId, executable.get(), compile));
2703 JSC::ExecState* exec =
d->currentFrame;
2704 JSC::EvalExecutable *executable = program_d->
executable(exec,
d);
2706 JSC::JSValue result =
d->evaluateHelper(exec, program_d->
sourceId,
2707 executable, compile);
2710 return d->scriptValueFromJSCValue(result);
2756 JSC::CallFrame* newFrame =
d->pushContext(
d->currentFrame,
d->currentFrame->globalData().dynamicGlobalObject,
2762 return d->contextForFrame(newFrame);
2779 const JSC::ArgList& args, JSC::JSObject *callee,
bool calledAsConstructor,
2780 bool clearScopeChain)
2782 JSC::JSValue thisObject = _thisObject;
2789 callee = originalGlobalObject();
2791 if (calledAsConstructor) {
2793 JSC::JSValue
prototype = callee->get(exec, exec->propertyNames().prototype);
2794 JSC::Structure *structure = prototype.isObject() ? JSC::asObject(prototype)->inheritorID()
2795 : originalGlobalObject()->emptyObjectStructure();
2799 int flags = NativeContext;
2800 if (calledAsConstructor)
2801 flags |= CalledAsConstructorContext;
2806 || exec->returnPC() == 0 || (contextFlags(exec) & NativeContext)
2807 || (exec->codeBlock() && exec->callee() != callee)) {
2809 JSC::Interpreter *interp = exec->interpreter();
2810 JSC::Register *oldEnd = interp->registerFile().end();
2811 int argc = args.size() + 1;
2812 JSC::Register *newEnd = oldEnd + argc + JSC::RegisterFile::CallFrameHeaderSize;
2813 if (!interp->registerFile().grow(newEnd))
2816 newCallFrame[0] = thisObject;
2818 JSC::ArgList::const_iterator
it;
2819 for (it = args.begin(); it != args.end(); ++
it)
2820 newCallFrame[++dst] = *it;
2821 newCallFrame += argc + JSC::RegisterFile::CallFrameHeaderSize;
2823 if (!clearScopeChain) {
2824 newCallFrame->init(0, 0, exec->scopeChain(), exec, flags | ShouldRestoreCallFrame, argc, callee);
2826 newCallFrame->init(0, 0, globalExec()->scopeChain(), exec, flags | ShouldRestoreCallFrame, argc, callee);
2829 setContextFlags(newCallFrame, flags);
2831 exec->registers()[JSC::RegisterFile::Callee] = JSC::JSValue(callee);
2833 if (calledAsConstructor) {
2835 JSC::Register* thisRegister = thisRegisterForFrame(newCallFrame);
2836 *thisRegister = thisObject;
2839 currentFrame = newCallFrame;
2840 return newCallFrame;
2856 if (
d->currentFrame->returnPC() != 0 ||
d->currentFrame->codeBlock() != 0
2858 qWarning(
"QScriptEngine::popContext() doesn't match with pushContext()");
2870 uint flags = contextFlags(currentFrame);
2871 bool hasScope = flags & HasScopeContext;
2872 if (flags & ShouldRestoreCallFrame) {
2873 JSC::RegisterFile ®isterFile = currentFrame->interpreter()->registerFile();
2874 JSC::Register *
const newEnd = currentFrame->registers() - JSC::RegisterFile::CallFrameHeaderSize - currentFrame->argumentCount();
2876 currentFrame->scopeChain()->pop()->deref();
2877 registerFile.shrink(newEnd);
2878 }
else if(hasScope) {
2879 currentFrame->setScopeChain(currentFrame->scopeChain()->pop());
2880 currentFrame->scopeChain()->deref();
2882 currentFrame = currentFrame->callerFrame();
2896 JSC::ExecState* exec =
d->globalExec();
2897 return exec->hadException() ||
d->currentException().isValid();
2914 JSC::ExecState* exec =
d->globalExec();
2915 if (exec->hadException())
2916 result = const_cast<QScriptEnginePrivate*>(
d)->scriptValueFromJSCValue(exec->exception());
2918 result =
d->currentException();
2973 JSC::ExecState* exec =
d->currentFrame;
2974 exec->clearException();
2975 d->clearCurrentException();
3013 d->setDefaultPrototype(metaTypeId,
d->scriptValueToJSCValue(prototype));
3053 return d->scriptValueFromJSCValue(
d->create(
d->currentFrame, type, ptr));
3059 JSC::JSValue result;
3068 return JSC::jsUndefined();
3070 return JSC::jsBoolean(*reinterpret_cast<const bool*>(ptr));
3072 return JSC::jsNumber(exec, *reinterpret_cast<const int*>(ptr));
3074 return JSC::jsNumber(exec, *reinterpret_cast<const uint*>(ptr));
3076 return JSC::jsNumber(exec,
qsreal(*reinterpret_cast<const qlonglong*>(ptr)));
3078 return JSC::jsNumber(exec,
qsreal(*reinterpret_cast<const qulonglong*>(ptr)));
3080 return JSC::jsNumber(exec,
qsreal(*reinterpret_cast<const double*>(ptr)));
3082 return JSC::jsString(exec, *reinterpret_cast<const QString*>(ptr));
3084 return JSC::jsNumber(exec, *reinterpret_cast<const float*>(ptr));
3086 return JSC::jsNumber(exec, *reinterpret_cast<const short*>(ptr));
3088 return JSC::jsNumber(exec, *reinterpret_cast<const unsigned short*>(ptr));
3090 return JSC::jsNumber(exec, *reinterpret_cast<const char*>(ptr));
3092 return JSC::jsNumber(exec, *reinterpret_cast<const unsigned char*>(ptr));
3094 return JSC::jsNumber(exec, (*reinterpret_cast<const QChar*>(ptr)).unicode());
3096 result = arrayFromStringList(exec, *reinterpret_cast<const QStringList *>(ptr));
3099 result = arrayFromVariantList(exec, *reinterpret_cast<const QVariantList *>(ptr));
3102 result = objectFromVariantMap(exec, *reinterpret_cast<const QVariantMap *>(ptr));
3105 result =
newDate(exec, *reinterpret_cast<const QDateTime *>(ptr));
3110 #ifndef QT_NO_REGEXP 3112 result =
newRegExp(exec, *reinterpret_cast<const QRegExp *>(ptr));
3115 #ifndef QT_NO_QOBJECT 3118 result = eng->
newQObject(*reinterpret_cast<QObject* const *>(ptr));
3122 result = eng->
newVariant(*reinterpret_cast<const QVariant*>(ptr));
3125 if (type == qMetaTypeId<QScriptValue>()) {
3128 return JSC::jsUndefined();
3131 #ifndef QT_NO_QOBJECT 3133 else if (type == qMetaTypeId<QObjectList>()) {
3134 qScriptRegisterSequenceMetaType<QObjectList>(eng->q_func());
3135 return create(exec, type, ptr);
3139 qScriptRegisterSequenceMetaType<QList<int> >(eng->q_func());
3140 return create(exec, type, ptr);
3145 if (typeName.
endsWith(
'*') && !*
reinterpret_cast<void*
const *
>(
ptr))
3146 return JSC::jsNull();
3152 if (result && result.isObject() && info && info->
prototype 3154 JSC::asObject(result)->setPrototype(info->
prototype);
3174 *
reinterpret_cast<bool*
>(
ptr) =
toBool(exec, value);
3177 *
reinterpret_cast<int*
>(
ptr) = toInt32(exec, value);
3180 *
reinterpret_cast<uint*
>(
ptr) = toUInt32(exec, value);
3189 *
reinterpret_cast<double*
>(
ptr) = toNumber(exec, value);
3192 if (value.isUndefined() || value.isNull())
3193 *reinterpret_cast<QString*>(ptr) =
QString();
3198 *
reinterpret_cast<float*
>(
ptr) = toNumber(exec, value);
3201 *
reinterpret_cast<short*
>(
ptr) =
short(toInt32(exec, value));
3207 *
reinterpret_cast<char*
>(
ptr) =
char(toInt32(exec, value));
3210 *
reinterpret_cast<unsigned char*
>(
ptr) = (
unsigned char)(toInt32(exec, value));
3213 if (value.isString()) {
3221 if (isDate(value)) {
3222 *
reinterpret_cast<QDateTime *
>(
ptr) = toDateTime(exec, value);
3226 if (isDate(value)) {
3227 *
reinterpret_cast<QDate *
>(
ptr) = toDateTime(exec, value).date();
3230 #ifndef QT_NO_REGEXP 3232 if (isRegExp(value)) {
3233 *
reinterpret_cast<QRegExp *
>(
ptr) = toRegExp(exec, value);
3237 #ifndef QT_NO_QOBJECT 3239 if (isQObject(value) || value.isNull()) {
3240 *
reinterpret_cast<QObject* *
>(
ptr) = toQObject(exec, value);
3244 if (isQObject(value) || value.isNull()) {
3245 QObject *qo = toQObject(exec, value);
3247 *
reinterpret_cast<QWidget* *
>(
ptr) = reinterpret_cast<QWidget*>(qo);
3253 if (isArray(value)) {
3254 *
reinterpret_cast<QStringList *
>(
ptr) = stringListFromArray(exec, value);
3258 if (isArray(value)) {
3259 *
reinterpret_cast<QVariantList *
>(
ptr) = variantListFromArray(exec, JSC::asArray(value));
3263 if (isObject(value)) {
3264 *
reinterpret_cast<QVariantMap *
>(
ptr) = variantMapFromObject(exec, JSC::asObject(value));
3268 *
reinterpret_cast<QVariant*
>(
ptr) = toVariant(exec, value);
3275 #ifndef QT_NO_QOBJECT 3276 if (convertToNativeQObject(exec, value, name, reinterpret_cast<void* *>(ptr)))
3279 if (isVariant(value) && name.
endsWith(
'*')) {
3281 QVariant &var = variantValue(value);
3283 *
reinterpret_cast<void* *
>(
ptr) = var.
data();
3287 JSC::JSValue proto = JSC::asObject(value)->prototype();
3288 while (proto.isObject()) {
3289 bool canCast =
false;
3290 if (isVariant(proto)) {
3291 canCast = (type == variantValue(proto).userType())
3292 || (valueType && (valueType == variantValue(proto).userType()));
3294 #ifndef QT_NO_QOBJECT 3295 else if (isQObject(proto)) {
3297 if (
QObject *qobject = toQObject(exec, proto))
3298 canCast = qobject->qt_metacast(className) != 0;
3304 *reinterpret_cast<void* *>(ptr) = *
reinterpret_cast<void* *
>(var.
data());
3306 *
reinterpret_cast<void* *
>(
ptr) = var.
data();
3309 proto = JSC::asObject(proto)->prototype();
3312 }
else if (value.isNull() && name.
endsWith(
'*')) {
3313 *
reinterpret_cast<void* *
>(
ptr) = 0;
3315 }
else if (type == qMetaTypeId<QScriptValue>()) {
3323 #ifndef QT_NO_QOBJECT 3324 else if (type == qMetaTypeId<QObjectList>()) {
3327 qScriptRegisterSequenceMetaType<QObjectList>(eng->q_func());
3334 qScriptRegisterSequenceMetaType<QList<int> >(eng->q_func());
3340 qWarning(
"QScriptEngine::convert: unable to convert value to type `%s'",
3366 *
reinterpret_cast<double*
>(
ptr) = value;
3372 *
reinterpret_cast<float*
>(
ptr) = value;
3451 if (url != cachedTranslationUrl) {
3453 cachedTranslationUrl = url;
3455 return cachedTranslationContext;
3505 d->m_typeInfos.insert(type, info);
3509 info->
prototype =
d->scriptValueToJSCValue(prototype);
3540 JSC::ExecState* exec =
d->currentFrame;
3541 JSC::JSValue jscObject =
d->scriptValueToJSCValue(
object);
3542 JSC::JSGlobalObject *glob =
d->originalGlobalObject();
3543 if (!jscObject || !jscObject.isObject())
3544 jscObject =
d->globalObject();
3547 #ifndef QT_NO_TRANSLATION 3548 JSC::asObject(jscObject)->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec,
"qsTranslate"),
QScript::functionQsTranslate));
3549 JSC::asObject(jscObject)->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec,
"QT_TRANSLATE_NOOP"),
QScript::functionQsTranslateNoOp));
3550 JSC::asObject(jscObject)->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec,
"qsTr"),
QScript::functionQsTr));
3551 JSC::asObject(jscObject)->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"QT_TR_NOOP"),
QScript::functionQsTrNoOp));
3552 JSC::asObject(jscObject)->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"qsTrId"),
QScript::functionQsTrId));
3553 JSC::asObject(jscObject)->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"QT_TRID_NOOP"),
QScript::functionQsTrIdNoOp));
3556 glob->stringPrototype()->putDirectFunction(exec,
new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec,
"arg"),
QScript::stringProtoFuncArg));
3574 #if defined(QT_NO_QOBJECT) || defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) 3579 if (
d->importedExtensions.contains(extension))
3594 for (
int i = 0; i < pathComponents.
count(); ++i) {
3598 if (
d->importedExtensions.contains(ext))
3601 if (
d->extensionsBeingImported.contains(ext)) {
3605 d->extensionsBeingImported.insert(ext);
3612 for (
int j = 0; j < staticPlugins.
size(); ++j) {
3625 for (
int j = 0; j <= i; ++j) {
3634 initjsContents = ts.
readAll();
3635 initjsFileName = path;
3640 if (!iface && initjsContents.
isEmpty()) {
3642 for (
int j = 0; j < libraryPaths.
count(); ++j) {
3650 for (
int k = 0; k < files.
count(); ++k) {
3664 QDir dirdir(libPath);
3665 bool dirExists = dirdir.
exists();
3666 for (
int k = 0; dirExists && (k <= i); ++k)
3667 dirExists = dirdir.
cd(pathComponents.
at(k));
3668 if (dirExists && dirdir.
exists(initDotJs)) {
3673 initjsContents = ts.
readAll();
3674 initjsFileName = file.fileName();
3679 if (iface || !initjsContents.
isEmpty())
3684 if (!iface && initjsContents.
isEmpty()) {
3685 d->extensionsBeingImported.remove(ext);
3701 if (!initjsContents.
isEmpty()) {
3705 d->extensionsBeingImported.remove(ext);
3716 d->extensionsBeingImported.remove(ext);
3728 d->extensionsBeingImported.remove(ext);
3735 d->importedExtensions.insert(ext);
3736 d->extensionsBeingImported.remove(ext);
3738 #endif // QT_NO_QOBJECT 3756 #if defined(QT_NO_QOBJECT) || defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) 3766 for (
int i = 0; i < staticPlugins.
size(); ++i) {
3771 for (
int j = 0; j < keys.
count(); ++j)
3772 result << keys.
at(j);
3777 for (
int i = 0; i < libraryPaths.
count(); ++i) {
3785 for (
int j = 0; j < files.
count(); ++j) {
3793 for (
int k = 0; k < keys.
count(); ++k)
3794 result << keys.
at(k);
3805 if (dd.exists(initDotJs)) {
4100 d->collectGarbage();
4130 d->reportAdditionalMemoryCost(size);
4159 d->processEventsInterval = interval;
4162 d->globalData->timeoutChecker->setCheckInterval(interval);
4164 d->timeoutChecker()->setShouldProcessEvents(interval > 0);
4177 return d->processEventsInterval;
4194 return (
d->currentFrame !=
d->globalExec()) ||
d->inEval;
4221 d->abortResult = result;
4222 d->timeoutChecker()->setShouldAbort(
true);
4223 JSC::throwError(
d->currentFrame, JSC::createInterruptedExecutionException(&
d->currentFrame->globalData()).
toObject(
d->currentFrame));
4226 #ifndef QT_NO_QOBJECT 4245 if (!sender || !signal)
4249 if (receiver.
isObject() && (receiver.
engine() !=
function.engine()))
4255 return engine->
scriptConnect(sender, signal, jscReceiver, jscFunction,
4275 if (!sender || !signal)
4279 if (receiver.
isObject() && (receiver.
engine() !=
function.engine()))
4302 #include "moc_qscriptengine.cpp" 4305 #endif // QT_NO_QOBJECT 4328 if (agent && (agent->
engine() !=
this)) {
4329 qWarning(
"QScriptEngine::setAgent(): " 4330 "cannot set agent belonging to different engine");
4356 return d->activeAgent;
4376 return d->toStringHandle(JSC::Identifier(
d->currentFrame, str));
4405 JSC::JSValue jscValue =
d->scriptValueToJSCValue(value);
4406 if (!jscValue || jscValue.isUndefined() || jscValue.isNull())
4408 JSC::ExecState* exec =
d->currentFrame;
4409 JSC::JSValue result = jscValue.toObject(exec);
4410 return d->scriptValueFromJSCValue(result);
4513 return d->errorLineNumber;
4527 return d->errorColumnNumber;
4541 return d->errorMessage;
4554 #ifdef QT_BUILD_INTERNAL 4567 #pragma optimize("", off) The QVariant class acts like a union for the most common Qt data types.
QScriptValue newFunction(FunctionSignature signature, int length=0)
Creates a QScriptValue that wraps a native (C++) function.
The QDir class provides access to directory structures and their contents.
static unsigned propertyFlagsToJSCAttributes(const QScriptValue::PropertyFlags &flags)
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int dayOfWeek() const
Returns the weekday (1 = Monday to 7 = Sunday) for this date.
void(* DemarshalFunction)(const QScriptValue &, void *)
The QScriptContext class represents a Qt Script function invocation.
QScriptObject * wrapperObject() const
QScriptEngine()
Constructs a QScriptEngine object.
QScriptValuePrivate * next
QScriptValue(* FunctionSignature)(QScriptContext *, QScriptEngine *)
QScriptValue evaluate(const QString &program, const QString &fileName=QString(), int lineNumber=1)
Evaluates program, using lineNumber as the base line number, and returns the result of the evaluation...
QScriptSyntaxCheckResultPrivate()
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
QScriptValue property(const QString &name, const ResolveFlags &mode=ResolvePrototype) const
Returns the value of this QScriptValue's property with the given name, using the given mode to resolv...
static JSC::JSValue JSC_HOST_CALL functionQsTranslateNoOp(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
static bool isObject(JSC::JSValue)
static JSC::ExecState * frameForContext(QScriptContext *context)
Encoding
This enum type defines the 8-bit encoding of character string arguments to translate(): ...
QScriptEnginePrivate * scriptEngineFromExec(const JSC::ExecState *exec)
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
static bool convertString(const QString &, int type, void *ptr)
WTF::RefPtr< JSC::Structure > variantWrapperObjectStructure
static JSC::JSValue jscValueFromVariant(JSC::ExecState *, const QVariant &value)
The QScriptClass class provides an interface for defining custom behavior of (a class of) Qt Script o...
static QStringList stringListFromArray(JSC::ExecState *, JSC::JSValue arr)
const QChar at(int i) const
Returns the character at the given index position in the string.
qsreal integerFromString(const QString &str, int radix)
static JSC::Register * thisRegisterForFrame(JSC::ExecState *frame)
bool addSignalHandler(QObject *sender, int signalIndex, JSC::JSValue receiver, JSC::JSValue slot, JSC::JSValue senderWrapper, Qt::ConnectionType type)
void detachAllRegisteredScriptStrings()
bool isFunction() const
Returns true if this QScriptValue is a function; otherwise returns false.
The QRegExp class provides pattern matching using regular expressions.
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsreal ToInteger(qsreal n)
virtual ~QScriptEngine()
Destroys this QScriptEngine.
WTF::RefPtr< JSC::Structure > qmetaobjectWrapperObjectStructure
static JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
#define it(className, varName)
bool canEvaluate(const QString &program) const
Returns true if program can be evaluated; i.
QObject * qobject() const
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
static QScriptEnginePrivate * get(QScriptEngine *q)
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QByteArray & append(char c)
Appends the character ch to this byte array.
static QVariant toVariant(JSC::ExecState *, JSC::JSValue)
static uint contextFlags(JSC::ExecState *)
For native context, we use the ReturnValueRegister entry in the stackframe header to store flags...
static JSC::JSValue create(JSC::ExecState *, int type, const void *ptr)
JSC::UString cachedTranslationContext
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
QScript::QObjectData * qobjectData(QObject *object)
static QVariantMap variantMapFromObject(JSC::ExecState *, JSC::JSObject *obj)
static JSC::JSValue JSC_HOST_CALL functionQsTrIdNoOp(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
Q_CORE_EXPORT void qFree(void *ptr)
qint32 toInt32() const
Returns the signed 32-bit integer value of this QScriptValue, using the conversion rules described in...
static JSC::JSValue JSC_HOST_CALL functionPrint(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
WTF::RefPtr< JSC::Structure > staticScopeObjectStructure
bool isError() const
Returns true if this QScriptValue is an object of the Error class; otherwise returns false...
bool remove(const T &value)
const_iterator constEnd() const
The QByteArray class provides an array of bytes.
QScriptSyntaxCheckResult::State state
QScriptValue throwError(Error error, const QString &text)
Throws an error with the given text.
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
JSC::JSValue defaultPrototype(int metaTypeId) const
int length() const
Returns the number of characters in this string.
int errorLineNumber() const
Returns the error line number of this QScriptSyntaxCheckResult, or -1 if there is no error...
static QRegExp toRegExp(JSC::ExecState *, JSC::JSValue)
static JSC::JSValue JSC_HOST_CALL functionQsTrId(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
bool removeSignalHandler(QObject *sender, int signalIndex, JSC::JSValue receiver, JSC::JSValue slot)
void registerCustomType(int type, MarshalFunction mf, DemarshalFunction df, const QScriptValue &prototype)
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
quint32 ToUInt32(qsreal n)
JSC::EvalExecutable * executable(JSC::ExecState *exec, QScriptEnginePrivate *engine)
JSC::CallFrame * pushContext(JSC::CallFrame *exec, JSC::JSValue thisObject, const JSC::ArgList &args, JSC::JSObject *callee, bool calledAsConstructor=false, bool clearScopeChain=false)
JSC native function doesn't have different stackframe or context.
QScriptValue globalObject() const
Returns this engine's Global Object.
QScriptValue objectById(qint64 id) const
Returns the object with the given id, or an invalid QScriptValue if there is no object with that id...
virtual bool didTimeOut(JSC::ExecState *exec)
static QScriptValuePrivate * get(const QScriptValue &q)
static PassRefPtr< UStringSourceProviderWithFeedback > create(const JSC::UString &source, const JSC::UString &url, int lineNumber, QScriptEnginePrivate *engine)
static QObject * toQObject(JSC::ExecState *, JSC::JSValue)
void setProcessEventsInterval(int interval)
Sets the interval between calls to QCoreApplication::processEvents to interval milliseconds.
QScriptObjectDelegate * delegate() const
int day() const
Returns the day of the month (1 to 31) of this date.
static JSC::JSValue JSC_HOST_CALL functionVersion(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
static bool canEvaluate(const QString &program)
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
QScript::QVariantPrototype * variantPrototype
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QList< QScriptEngineAgent * > ownedAgents
The QDate class provides date functions.
QScriptStringPrivate * prev
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QScriptValue newRegExp(const QRegExp ®exp)
Creates a QtScript object of class RegExp with the given regexp.
int msec() const
Returns the millisecond part (0 to 999) of the time.
static void init(QScriptString &q, QScriptStringPrivate *d)
int count(const T &t) const
Returns the number of occurrences of value in the list.
JSC::JSObject * globalObject() const
void setShouldProcessEvents(bool shouldProcess)
static QScriptDeclarativeClass * declarativeClass(JSC::JSValue)
static JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
T & value() const
Returns a modifiable reference to the current item's value.
void popContext()
Pops the current execution context and restores the previous one.
bool hasDemarshalFunction(int type) const
static qsreal toNumber(JSC::ExecState *, JSC::JSValue)
static const JSC::ClassInfo info
The QString class provides a Unicode character string.
QMap< QString, QVariant > QVariantMap
T * qobject_cast(QObject *object)
static WTF::PassRefPtr< JSC::Structure > createStructure(JSC::JSValue proto)
The QObject class is the base class of all Qt objects.
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
virtual QScriptValue prototype() const
Returns the object to be used as the prototype of new instances of this class (created with QScriptEn...
static QChar separator()
Returns the native directory separator: "/" under Unix (including Mac OS X) and "\\" under Windows...
Qt::CaseSensitivity caseSensitivity() const
Returns Qt::CaseSensitive if the regexp is matched case sensitively; otherwise returns Qt::CaseInsens...
static QObjectList staticInstances()
Returns a list of static plugin instances (root components) held by the plugin loader.
QScriptString toStringHandle(const QString &str)
Returns a handle that represents the given string, str.
The QChar class provides a 16-bit Unicode character.
void setThisObject(const QScriptValue &thisObject)
Sets the `this' object associated with this QScriptContext to be thisObject.
int processEventsInterval
const T value(const Key &key) const
Returns the value associated with the key.
static QVariant convertValue(GConfValue *src)
bool exists() const
Returns true if the directory exists; otherwise returns false.
static JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
JSC::ExecState * currentFrame
static void setContextFlags(JSC::ExecState *, uint)
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes all pending events for the calling thread according to the specified flags until there are ...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
~QScriptSyntaxCheckResult()
Destroys this QScriptSyntaxCheckResult.
The QScriptString class acts as a handle to "interned" strings in a QScriptEngine.
void disposeQObject(QObject *object)
QScriptString toStringHandle(const JSC::Identifier &name)
Result checkSyntax(const QString &code)
QScriptValue(* FunctionWithArgSignature)(QScriptContext *, QScriptEngine *, void *)
Q_CORE_EXPORT void qDebug(const char *,...)
static bool toBool(Register *reg, int type, bool *ok=0)
static JSC::JSValue JSC_HOST_CALL stringProtoFuncArg(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
bool removeOne(const T &t)
Removes the first occurrence of value in the list and returns true on success; otherwise returns fals...
void reserve(int size)
Attempts to allocate memory for at least size characters.
void setOwnership(QScriptEngine::ValueOwnership ownership)
QScriptSyntaxCheckResult & operator=(const QScriptSyntaxCheckResult &other)
Assigns the other result to this QScriptSyntaxCheckResult, and returns a reference to this QScriptSyn...
QScriptValue defaultPrototype(int metaTypeId) const
Returns the default prototype associated with the given metaTypeId, or an invalid QScriptValue if no ...
static QString toString(Register *reg, int type, bool *ok=0)
~QScriptSyntaxCheckResultPrivate()
static bool convertToNativeQObject(JSC::ExecState *, JSC::JSValue, const QByteArray &targetType, void **result)
void append(const T &t)
Inserts value at the end of the list.
The QScriptEngine class provides an environment for evaluating Qt Script code.
QStringList uncaughtExceptionBacktrace() const
Returns a human-readable backtrace of the last uncaught exception.
QScriptValuePrivate * prev
QString errorMessage() const
Returns the error message of this QScriptSyntaxCheckResult, or an empty string if there is no error...
The QTime class provides clock time functions.
int dayOfYear() const
Returns the day of the year (1 to 365 or 366 on leap years) for this date.
static bool isVariant(JSC::JSValue)
static qint32 toInt32(JSC::ExecState *, JSC::JSValue)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setValue(QObject *value)
void reportAdditionalMemoryCost(int size)
Reports an additional memory cost of the given size, measured in bytes, to the garbage collector...
static JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
bool isCollecting() const
QHash< QObject *, QScript::QObjectData * > m_qobjectData
QScriptStringPrivate * next
JSC::JSValue scriptValueToJSCValue(const QScriptValue &value)
bool canConvert(Type t) const
Returns true if the variant's type can be cast to the requested type, t.
Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax)
bool contains(const T &value) const
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
QScript::QMetaObjectPrototype * qmetaobjectPrototype
T takeFirst()
Removes the first item in the list and returns it.
QList< T > toList() const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QDateTime toLocalTime() const
Returns a datetime containing the date and time information in this datetime, but specified using the...
JSC::JSGlobalObject * originalGlobalObject() const
static JSC::UString toString(JSC::ExecState *, JSC::JSValue)
void setDefaultPrototype(int metaTypeId, JSC::JSValue prototype)
void installTranslatorFunctions(const QScriptValue &object=QScriptValue())
Installs translator functions on the given object, or on the Global Object if no object is specified...
const T & at(int i) const
Returns the item at index position i in the list.
QScriptEngine * engine() const
Returns the QScriptEngine that created this QScriptValue, or 0 if this QScriptValue is invalid or the...
The QStringList class provides a list of strings.
static WTF::PassRefPtr< JSC::Structure > createStructure(JSC::JSValue prototype)
void mark(JSC::MarkStack &)
static JSC::JSValue arrayFromStringList(JSC::ExecState *, const QStringList &lst)
static void setProperty(JSC::ExecState *, JSC::JSValue object, const JSC::UString &name, JSC::JSValue, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
bool qScriptConnect(QObject *sender, const char *signal, const QScriptValue &receiver, const QScriptValue &function)
Creates a connection from the signal in the sender to the given function.
static QDateTime toDateTime(JSC::ExecState *, JSC::JSValue)
const T & value() const
Returns the current item's value.
Q_CORE_EXPORT void qWarning(const char *,...)
bool isFunction(JSC::JSValue value)
int second() const
Returns the second part (0 to 59) of the time.
const_iterator insert(const T &value)
static const qsreal MsPerSecond
QHash< intptr_t, QScript::UStringSourceProviderWithFeedback * > loadedScripts
JSC::JSValue toUsableValue(JSC::JSValue value)
If the given value is the original global object, returns the custom global object or a proxy to the ...
static const char * data(const QByteArray &arr)
TimeoutCheckerProxy(const JSC::TimeoutChecker &originalChecker)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
const_iterator constFind(const Key &key) const
Returns an iterator pointing to the item with the key in the hash.
The QScriptSyntaxCheckResult class provides the result of a script syntax check.
Type
This enum type defines the types of variable that a QVariant can contain.
JSC::JSObject * getOriginalGlobalObjectProxy()
QScriptValue newObject()
Creates a QtScript object of class Object.
static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng)
ValueOwnership
This enum specifies the ownership when wrapping a C++ value, e.
JSC::UString translationContextFromUrl(const JSC::UString &)
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
QFileInfoList entryInfoList(Filters filters=NoFilter, SortFlags sort=NoSort) const
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
State
This enum specifies the state of a syntax check.
qsreal DateTimeToMs(JSC::ExecState *exec, const QDateTime &dt)
Converts a QDateTime to a JS date value (milliseconds).
const T * ptr(const T &t)
QScriptObject * findWrapper(QScriptEngine::ValueOwnership ownership, const QScriptEngine::QObjectWrapOptions &options) const
QScriptStringPrivate * registeredScriptStrings
const QMetaObject * metaObject() const
QSet< QScriptProgramPrivate * > registeredScriptPrograms
static JSC::JSValue newRegExp(JSC::ExecState *, const QRegExp &)
QByteArray left(int len) const
Returns a byte array that contains the leftmost len bytes of this byte array.
int minute() const
Returns the minute part (0 to 59) of the time.
void setGlobalObject(const QScriptValue &object)
Sets this engine's Global Object to be the given object.
static JSC::JSValue propertyHelper(JSC::ExecState *, JSC::JSValue, const JSC::Identifier &id, int resolveMode)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
bool m_shouldAbortEvaluation
void abortEvaluation(const QScriptValue &result=QScriptValue())
Aborts any script evaluation currently taking place in this engine.
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
const char * typeName() const
Returns the name of the type stored in the variant.
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
bool cd(const QString &dirName)
Changes the QDir's directory to dirName.
bool isEvaluating() const
Returns true if this engine is currently evaluating a script, otherwise returns false.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
int uncaughtExceptionLineNumber() const
Returns the line number where the last uncaught exception occurred.
Q_CORE_EXPORT bool qIsNaN(double d)
Returns true if the double {d} is not a number (NaN).
static bool convertV2(const QScriptValue &value, int type, void *ptr)
QDateTime toUTC() const
Returns a datetime containing the date and time information in this datetime, but specified using the...
QScriptValue newQObject(QObject *object, ValueOwnership ownership=QtOwnership, const QObjectWrapOptions &options=0)
Creates a QtScript object that wraps the given QObject object, using the given ownership.
void detachAllRegisteredScriptPrograms()
Q_CORE_EXPORT double qSNaN()
Returns the bit pattern of a signalling NaN as a double.
JSC::JSValue newVariant(const QVariant &)
bool convert(Type t)
Casts the variant to the requested type, t.
QHash< int, QScriptTypeInfo * > m_typeInfos
const char * constData() const
Returns a pointer to the data stored in the byte array.
QDate date() const
Returns the date part of the datetime.
static bool convertValue(JSC::ExecState *, JSC::JSValue value, int type, void *ptr)
bool m_shouldProcessEvents
static QByteArray prototype(const QList< QByteArray > ¶meterTypes, const QList< QByteArray > ¶meterNames, bool *ok)
static bool isDate(JSC::JSValue)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
QString join(const QString &sep) const
Joins all the string list's strings into a single string with each element separated by the given sep...
Q_CORE_EXPORT QString qtTrId(const char *id, int n=-1)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
static int MsFromTime(qsreal t)
qsreal ToNumber(const QString &)
QString pattern() const
Returns the pattern string of the regular expression.
static QVariantList variantListFromArray(JSC::ExecState *, JSC::JSArray *arr)
Q_CORE_EXPORT void qFatal(const char *,...)
The QCoreApplication class provides an event loop for console Qt applications.
static bool isRegExp(JSC::JSValue)
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
QString baseName() const
Returns the base name of the file without the path.
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue's property with the given name to the given value.
static JSC::JSValue arrayFromVariantList(JSC::ExecState *, const QVariantList &lst)
bool scriptDisconnect(QObject *sender, const char *signal, JSC::JSValue receiver, JSC::JSValue function)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
int userType() const
Returns the storage type of the value stored in the variant.
WTF::RefPtr< JSC::Structure > scriptObjectStructure
QScriptEngine::DemarshalFunction demarshal
PatternSyntax patternSyntax() const
Returns the syntax used by the regular expression.
QString & append(QChar c)
PatternSyntax
The syntax used to interpret the meaning of the pattern.
static JSC::JSValue property(JSC::ExecState *, JSC::JSValue, const JSC::Identifier &id, int resolveMode=QScriptValue::ResolvePrototype)
The QDateTime class provides date and time functions.
virtual QStringList keys() const =0
static QScriptSyntaxCheckResult checkSyntax(const QString &program)
The QFile class provides an interface for reading from and writing to files.
static JSC::JSValue newArray(JSC::ExecState *, uint length)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
void setPrototype(const QScriptValue &prototype)
If this QScriptValue is an object, sets the internal prototype (__proto__ property) of this object to...
JSC::JSObject * customGlobalObject() const
QScript::TimeoutCheckerProxy * timeoutChecker() const
The QTextStream class provides a convenient interface for reading and writing text.
static QScriptEngineAgent * get(QScriptEngineAgentPrivate *p)
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
virtual void contextPop()
This function is called when the current script context is about to be popped.
Q_CORE_EXPORT double qInf()
Returns the bit pattern for an infinite number as a double.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
QScriptEngineAgent * activeAgent
void setShouldAbort(bool shouldAbort)
QScript::QObjectPrototype * qobjectPrototype
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
void collectGarbage()
Runs the garbage collector.
static QStringList libraryPaths()
Returns a list of paths that the application will search when dynamically loading libraries...
static bool isQObject(JSC::JSValue)
QString relativeFilePath(const QString &fileName) const
Returns the path to fileName relative to the directory.
QObject * parent() const
Returns a pointer to the parent object.
static quint32 toUInt32(JSC::ExecState *, JSC::JSValue)
void reportAdditionalMemoryCost(int size)
QList< QVariant > QVariantList
int processEventsInterval() const
Returns the interval in milliseconds between calls to QCoreApplication::processEvents() while the int...
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
int size() const
Returns the number of items in the list.
PropertyFlag
This enum describes the attributes of a property.
QScriptContext * currentContext() const
Returns the current context.
QScriptValuePrivate * freeScriptValues
virtual void initialize(const QString &key, QScriptEngine *engine)=0
QScriptValue importExtension(const QString &extension)
Imports the given extension into this QScriptEngine.
QString canonicalPath() const
Returns the canonical path, i.e.
JSC::JSObject * customGlobalObject
static QScriptDeclarativeClass::Object * declarativeObject(JSC::JSValue)
#define Q_AUTOTEST_EXPORT
JSC::JSObject * originalGlobalObjectProxy
QScriptValue create(int type, const void *ptr)
const_iterator constBegin() const
static JSC::JSValue JSC_HOST_CALL functionQsTrNoOp(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
QScriptContext * pushContext()
Enters a new execution context and returns the associated QScriptContext object.
JSC::JSValue newQObject(QObject *object, QScriptEngine::ValueOwnership ownership=QScriptEngine::QtOwnership, const QScriptEngine::QObjectWrapOptions &options=0)
bool isQObject() const
Returns true if this QScriptValue is a QObject; otherwise returns false.
void clearExceptions()
Clears any uncaught exceptions in this engine.
int size() const
Returns the number of bytes in this byte array.
QSet< JSC::JSObject * > visitedConversionObjects
void emitSignalHandlerException()
QScriptValue(* MarshalFunction)(QScriptEngine *, const void *)
QStringList availableExtensions() const
Returns a list naming the available extensions that can be imported using the importExtension() funct...
static QVariant & variantValue(JSC::JSValue value)
static QScriptSyntaxCheckResult checkSyntax(const QString &program)
Checks the syntax of the given program.
QScriptSyntaxCheckResult()
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
The QScriptProgram class encapsulates a Qt Script program.
int mostGeneralMethod(QMetaMethod *out=0) const
static int toDigit(char c)
QScopedPointer< QObjectData > d_ptr
QScriptValue newDate(qsreal value)
Creates a QtScript object of class Date with the given value (the number of milliseconds since 01 Jan...
T takeLast()
Removes the last item in the list and returns it.
QScriptEngineAgent * agent() const
Returns the agent currently installed on this engine, or 0 if no agent is installed.
static bool convertNumber(qsreal, int type, void *ptr)
void setDelegate(QScriptObjectDelegate *delegate)
QDateTime MsToDateTime(JSC::ExecState *exec, qsreal t)
Converts a JS date value (milliseconds) to a QDateTime (local time).
QScriptValue newQMetaObject(const QMetaObject *metaObject, const QScriptValue &ctor=QScriptValue())
Creates a QtScript object that represents a QObject class, using the the given metaObject and constru...
QString readAll()
Reads the entire content of the stream, and returns it as a QString.
virtual void contextPush()
This function is called when a new script context has been pushed.
void mark(JSC::MarkStack &markStack)
int year() const
Returns the year of this date.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
quint16 ToUInt16(qsreal n)
static QScriptValue::PropertyFlags propertyFlags(JSC::ExecState *, JSC::JSValue value, const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode)
JSC::JSGlobalData * globalData
QScriptValue scriptValueFromJSCValue(JSC::JSValue value)
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
int qstrcmp(const QByteArray &str1, const char *str2)
QScriptValue activationObject() const
Returns the activation object of this QScriptContext.
QTime time() const
Returns the time part of the datetime.
QScriptValue undefinedValue()
Returns a QScriptValue of the primitive type Undefined.
void _q_objectDestroyed(QObject *)
QScriptValuePrivate * registeredScriptValues
JSC::UString cachedTranslationUrl
QObject * instance()
Returns the root component object of the plugin.
bool qScriptDisconnect(QObject *sender, const char *signal, const QScriptValue &receiver, const QScriptValue &function)
Disconnects the signal in the sender from the given (receiver, function) pair.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
static void setVariantValue(JSC::JSValue objectValue, const QVariant &value)
QStringList importedExtensions() const
Returns a list naming the extensions that have been imported using the importExtension() function...
static bool toBool(JSC::ExecState *, JSC::JSValue)
static JSC::JSValue JSC_HOST_CALL functionGC(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
bool convert(const QScriptValue &value, int type, void *ptr)
QList< int > overloadedIndexes() const
void setAgent(QScriptEngineAgent *agent)
Installs the given agent on this engine.
static bool isArray(JSC::JSValue)
QScriptValue newArray(uint length=0)
Creates a QtScript object of class Array with the given length.
static JSC::JSValue objectFromVariantMap(JSC::ExecState *, const QVariantMap &vmap)
static QScriptProgramPrivate * get(const QScriptProgram &q)
The QFileInfo class provides system-independent file information.
JSC::JSValue newQMetaObject(const QMetaObject *metaObject, JSC::JSValue ctor)
void setOptions(QScriptEngine::QObjectWrapOptions options)
int errorColumnNumber() const
Returns the error column number of this QScriptSyntaxCheckResult, or -1 if there is no error...
bool hasUncaughtException() const
Returns true if the last script evaluation resulted in an uncaught exception; otherwise returns false...
void agentDeleted(QScriptEngineAgent *agent)
virtual void close()
Calls QFile::flush() and closes the file.
QScriptValue newActivationObject()
JSC::JSValue evaluateHelper(JSC::ExecState *exec, intptr_t sourceId, JSC::EvalExecutable *executable, bool &compile)
void setDefaultPrototype(int metaTypeId, const QScriptValue &prototype)
Sets the default prototype of the C++ type identified by the given metaTypeId to prototype.
#define qPrintable(string)
static JSC::JSValue thisForContext(JSC::ExecState *frame)
static qreal dot(const QPointF &a, const QPointF &b)
The QScriptValue class acts as a container for the Qt Script data types.
QScriptValue toObject(const QScriptValue &value)
Converts the given value to an object, if such a conversion is possible; otherwise returns an invalid...
void setGlobalObject(JSC::JSObject *object)
static const JSC::ClassInfo info
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
QExplicitlySharedDataPointer< QScriptSyntaxCheckResultPrivate > d_ptr
The QScriptEngineAgent class provides an interface to report events pertaining to QScriptEngine execu...
WTF::RefPtr< JSC::Structure > qobjectWrapperObjectStructure
QScriptEnginePrivate * engine
QScriptValue call(const QScriptValue &thisObject=QScriptValue(), const QScriptValueList &args=QScriptValueList())
Calls this QScriptValue as a function, using thisObject as the `this' object in the function call...
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
QScriptValue argument(int index) const
Returns the function argument at the given index.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
bool isValid() const
Returns true if this QScriptValue is valid; otherwise returns false.
static QVariant jscValueToVariant(JSC::ExecState *, JSC::JSValue value, int targetType)
QScriptValue newVariant(const QVariant &value)
Creates a QtScript object holding the given variant value.
QScriptValue nullValue()
Returns a QScriptValue of the primitive type Null.
QScriptEngine::MarshalFunction marshal
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
QScriptContext * parentContext() const
Returns the parent context of this QScriptContext.
Q_CORE_EXPORT bool qIsInf(double d)
Returns true if the double {d} is equivalent to infinity.
static bool hasValidCodeBlockRegister(JSC::ExecState *frame)
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...
bool scriptConnect(QObject *sender, const char *signal, JSC::JSValue receiver, JSC::JSValue function, Qt::ConnectionType type)
void registerWrapper(QScriptObject *wrapper, QScriptEngine::ValueOwnership ownership, const QScriptEngine::QObjectWrapOptions &options)
QScriptValue uncaughtException() const
Returns the current uncaught exception, or an invalid QScriptValue if there is no uncaught exception...
void setData(const QScriptValue &data)
Sets the internal data of this QScriptValue object.
int hour() const
Returns the hour part (0 to 23) of the time.
bool endsWith(const QByteArray &a) const
Returns true if this byte array ends with byte array ba; otherwise returns false. ...
void detachAllRegisteredScriptValues()
The QPluginLoader class loads a plugin at run-time.
virtual ~QScriptEnginePrivate()
int signalIndex(const char *signalName) const
Returns the signal index used in the internal connectionLists vector.
friend class const_iterator
State state() const
Returns the state of this QScriptSyntaxCheckResult.
void registerScriptString(QScriptStringPrivate *value)
bool isMinimal() const
Returns true if minimal (non-greedy) matching is enabled; otherwise returns false.