diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2012-11-27 20:20:02 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2012-11-28 11:11:47 +0100 |
commit | 5ea0937167024f0f777b3a7cf27728ae46897240 (patch) | |
tree | 0b95199af3991875ce0f3c8377cf86241e2c659f /src/libs/qmljs/qmljsvalueowner.cpp | |
parent | 964c01a460323adb871682a66283816d5d826a05 (diff) | |
download | qt-creator-5ea0937167024f0f777b3a7cf27728ae46897240.tar.gz |
QmlJS: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I0c5654a978f47a4db5428936fd44633f21394830
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src/libs/qmljs/qmljsvalueowner.cpp')
-rw-r--r-- | src/libs/qmljs/qmljsvalueowner.cpp | 570 |
1 files changed, 285 insertions, 285 deletions
diff --git a/src/libs/qmljs/qmljsvalueowner.cpp b/src/libs/qmljs/qmljsvalueowner.cpp index e79dda0fdd..7eecbffe92 100644 --- a/src/libs/qmljs/qmljsvalueowner.cpp +++ b/src/libs/qmljs/qmljsvalueowner.cpp @@ -125,377 +125,377 @@ SharedValueOwner::SharedValueOwner() // set up the Global object _globalObject = newObject(); - _globalObject->setClassName("Global"); + _globalObject->setClassName(QLatin1String("Global")); ObjectValue *objectInstance = newObject(); - objectInstance->setClassName("Object"); - objectInstance->setMember("length", numberValue()); + objectInstance->setClassName(QLatin1String("Object")); + objectInstance->setMember(QLatin1String("length"), numberValue()); _objectCtor = new Function(this); - _objectCtor->setMember("prototype", _objectPrototype); + _objectCtor->setMember(QLatin1String("prototype"), _objectPrototype); _objectCtor->setReturnValue(objectInstance); - _objectCtor->addArgument(unknownValue(), "value"); + _objectCtor->addArgument(unknownValue(), QLatin1String("value")); _objectCtor->setOptionalNamedArgumentCount(1); FunctionValue *functionInstance = new FunctionValue(this); _functionCtor = new Function(this); - _functionCtor->setMember("prototype", _functionPrototype); + _functionCtor->setMember(QLatin1String("prototype"), _functionPrototype); _functionCtor->setReturnValue(functionInstance); _functionCtor->setVariadic(true); ObjectValue *arrayInstance = newObject(_arrayPrototype); - arrayInstance->setClassName("Array"); - arrayInstance->setMember("length", numberValue()); + arrayInstance->setClassName(QLatin1String("Array")); + arrayInstance->setMember(QLatin1String("length"), numberValue()); _arrayCtor = new Function(this); - _arrayCtor->setMember("prototype", _arrayPrototype); + _arrayCtor->setMember(QLatin1String("prototype"), _arrayPrototype); _arrayCtor->setReturnValue(arrayInstance); _arrayCtor->setVariadic(true); ObjectValue *stringInstance = newObject(_stringPrototype); - stringInstance->setClassName("String"); - stringInstance->setMember("length", numberValue()); + stringInstance->setClassName(QLatin1String("String")); + stringInstance->setMember(QLatin1String("length"), numberValue()); _stringCtor = new Function(this); - _stringCtor->setMember("prototype", _stringPrototype); + _stringCtor->setMember(QLatin1String("prototype"), _stringPrototype); _stringCtor->setReturnValue(stringInstance); - _stringCtor->addArgument(unknownValue(), "value"); + _stringCtor->addArgument(unknownValue(), QLatin1String("value")); _stringCtor->setOptionalNamedArgumentCount(1); ObjectValue *booleanInstance = newObject(_booleanPrototype); - booleanInstance->setClassName("Boolean"); + booleanInstance->setClassName(QLatin1String("Boolean")); _booleanCtor = new Function(this); - _booleanCtor->setMember("prototype", _booleanPrototype); + _booleanCtor->setMember(QLatin1String("prototype"), _booleanPrototype); _booleanCtor->setReturnValue(booleanInstance); - _booleanCtor->addArgument(unknownValue(), "value"); + _booleanCtor->addArgument(unknownValue(), QLatin1String("value")); ObjectValue *numberInstance = newObject(_numberPrototype); - numberInstance->setClassName("Number"); + numberInstance->setClassName(QLatin1String("Number")); _numberCtor = new Function(this); - _numberCtor->setMember("prototype", _numberPrototype); + _numberCtor->setMember(QLatin1String("prototype"), _numberPrototype); _numberCtor->setReturnValue(numberInstance); - _numberCtor->addArgument(unknownValue(), "value"); + _numberCtor->addArgument(unknownValue(), QLatin1String("value")); _numberCtor->setOptionalNamedArgumentCount(1); ObjectValue *dateInstance = newObject(_datePrototype); - dateInstance->setClassName("Date"); + dateInstance->setClassName(QLatin1String("Date")); _dateCtor = new Function(this); - _dateCtor->setMember("prototype", _datePrototype); + _dateCtor->setMember(QLatin1String("prototype"), _datePrototype); _dateCtor->setReturnValue(dateInstance); _dateCtor->setVariadic(true); ObjectValue *regexpInstance = newObject(_regexpPrototype); - regexpInstance->setClassName("RegExp"); - regexpInstance->setMember("source", stringValue()); - regexpInstance->setMember("global", booleanValue()); - regexpInstance->setMember("ignoreCase", booleanValue()); - regexpInstance->setMember("multiline", booleanValue()); - regexpInstance->setMember("lastIndex", numberValue()); + regexpInstance->setClassName(QLatin1String("RegExp")); + regexpInstance->setMember(QLatin1String("source"), stringValue()); + regexpInstance->setMember(QLatin1String("global"), booleanValue()); + regexpInstance->setMember(QLatin1String("ignoreCase"), booleanValue()); + regexpInstance->setMember(QLatin1String("multiline"), booleanValue()); + regexpInstance->setMember(QLatin1String("lastIndex"), numberValue()); _regexpCtor = new Function(this); - _regexpCtor->setMember("prototype", _regexpPrototype); + _regexpCtor->setMember(QLatin1String("prototype"), _regexpPrototype); _regexpCtor->setReturnValue(regexpInstance); - _regexpCtor->addArgument(unknownValue(), "pattern"); - _regexpCtor->addArgument(unknownValue(), "flags"); - - addFunction(_objectCtor, "getPrototypeOf", 1); - addFunction(_objectCtor, "getOwnPropertyDescriptor", 2); - addFunction(_objectCtor, "getOwnPropertyNames", arrayInstance, 1); - addFunction(_objectCtor, "create", 1, 1); - addFunction(_objectCtor, "defineProperty", 3); - addFunction(_objectCtor, "defineProperties", 2); - addFunction(_objectCtor, "seal", 1); - addFunction(_objectCtor, "freeze", 1); - addFunction(_objectCtor, "preventExtensions", 1); - addFunction(_objectCtor, "isSealed", booleanValue(), 1); - addFunction(_objectCtor, "isFrozen", booleanValue(), 1); - addFunction(_objectCtor, "isExtensible", booleanValue(), 1); - addFunction(_objectCtor, "keys", arrayInstance, 1); - - addFunction(_objectPrototype, "toString", stringValue(), 0); - addFunction(_objectPrototype, "toLocaleString", stringValue(), 0); - addFunction(_objectPrototype, "valueOf", 0); // ### FIXME it should return thisObject - addFunction(_objectPrototype, "hasOwnProperty", booleanValue(), 1); - addFunction(_objectPrototype, "isPrototypeOf", booleanValue(), 1); - addFunction(_objectPrototype, "propertyIsEnumerable", booleanValue(), 1); + _regexpCtor->addArgument(unknownValue(), QLatin1String("pattern")); + _regexpCtor->addArgument(unknownValue(), QLatin1String("flags")); + + addFunction(_objectCtor, QLatin1String("getPrototypeOf"), 1); + addFunction(_objectCtor, QLatin1String("getOwnPropertyDescriptor"), 2); + addFunction(_objectCtor, QLatin1String("getOwnPropertyNames"), arrayInstance, 1); + addFunction(_objectCtor, QLatin1String("create"), 1, 1); + addFunction(_objectCtor, QLatin1String("defineProperty"), 3); + addFunction(_objectCtor, QLatin1String("defineProperties"), 2); + addFunction(_objectCtor, QLatin1String("seal"), 1); + addFunction(_objectCtor, QLatin1String("freeze"), 1); + addFunction(_objectCtor, QLatin1String("preventExtensions"), 1); + addFunction(_objectCtor, QLatin1String("isSealed"), booleanValue(), 1); + addFunction(_objectCtor, QLatin1String("isFrozen"), booleanValue(), 1); + addFunction(_objectCtor, QLatin1String("isExtensible"), booleanValue(), 1); + addFunction(_objectCtor, QLatin1String("keys"), arrayInstance, 1); + + addFunction(_objectPrototype, QLatin1String("toString"), stringValue(), 0); + addFunction(_objectPrototype, QLatin1String("toLocaleString"), stringValue(), 0); + addFunction(_objectPrototype, QLatin1String("valueOf"), 0); // ### FIXME it should return thisObject + addFunction(_objectPrototype, QLatin1String("hasOwnProperty"), booleanValue(), 1); + addFunction(_objectPrototype, QLatin1String("isPrototypeOf"), booleanValue(), 1); + addFunction(_objectPrototype, QLatin1String("propertyIsEnumerable"), booleanValue(), 1); // set up the default Function prototype - _functionPrototype->setMember("constructor", _functionCtor); - addFunction(_functionPrototype, "toString", stringValue(), 0); - addFunction(_functionPrototype, "apply", 2); - addFunction(_functionPrototype, "call", 1, 0, true); - addFunction(_functionPrototype, "bind", 1, 0, true); + _functionPrototype->setMember(QLatin1String("constructor"), _functionCtor); + addFunction(_functionPrototype, QLatin1String("toString"), stringValue(), 0); + addFunction(_functionPrototype, QLatin1String("apply"), 2); + addFunction(_functionPrototype, QLatin1String("call"), 1, 0, true); + addFunction(_functionPrototype, QLatin1String("bind"), 1, 0, true); // set up the default Array prototype - addFunction(_arrayCtor, "isArray", booleanValue(), 1); - - _arrayPrototype->setMember("constructor", _arrayCtor); - addFunction(_arrayPrototype, "toString", stringValue(), 0); - addFunction(_arrayPrototype, "toLocalString", stringValue(), 0); - addFunction(_arrayPrototype, "concat", 0, 0, true); - addFunction(_arrayPrototype, "join", 1); - addFunction(_arrayPrototype, "pop", 0); - addFunction(_arrayPrototype, "push", 0, 0, true); - addFunction(_arrayPrototype, "reverse", 0); - addFunction(_arrayPrototype, "shift", 0); - addFunction(_arrayPrototype, "slice", 2); - addFunction(_arrayPrototype, "sort", 1); - addFunction(_arrayPrototype, "splice", 2); - addFunction(_arrayPrototype, "unshift", 0, 0, true); - addFunction(_arrayPrototype, "indexOf", numberValue(), 2, 1); - addFunction(_arrayPrototype, "lastIndexOf", numberValue(), 2, 1); - addFunction(_arrayPrototype, "every", 2, 1); - addFunction(_arrayPrototype, "some", 2, 1); - addFunction(_arrayPrototype, "forEach", 2, 1); - addFunction(_arrayPrototype, "map", 2, 1); - addFunction(_arrayPrototype, "filter", 2, 1); - addFunction(_arrayPrototype, "reduce", 2, 1); - addFunction(_arrayPrototype, "reduceRight", 2, 1); + addFunction(_arrayCtor, QLatin1String("isArray"), booleanValue(), 1); + + _arrayPrototype->setMember(QLatin1String("constructor"), _arrayCtor); + addFunction(_arrayPrototype, QLatin1String("toString"), stringValue(), 0); + addFunction(_arrayPrototype, QLatin1String("toLocalString"), stringValue(), 0); + addFunction(_arrayPrototype, QLatin1String("concat"), 0, 0, true); + addFunction(_arrayPrototype, QLatin1String("join"), 1); + addFunction(_arrayPrototype, QLatin1String("pop"), 0); + addFunction(_arrayPrototype, QLatin1String("push"), 0, 0, true); + addFunction(_arrayPrototype, QLatin1String("reverse"), 0); + addFunction(_arrayPrototype, QLatin1String("shift"), 0); + addFunction(_arrayPrototype, QLatin1String("slice"), 2); + addFunction(_arrayPrototype, QLatin1String("sort"), 1); + addFunction(_arrayPrototype, QLatin1String("splice"), 2); + addFunction(_arrayPrototype, QLatin1String("unshift"), 0, 0, true); + addFunction(_arrayPrototype, QLatin1String("indexOf"), numberValue(), 2, 1); + addFunction(_arrayPrototype, QLatin1String("lastIndexOf"), numberValue(), 2, 1); + addFunction(_arrayPrototype, QLatin1String("every"), 2, 1); + addFunction(_arrayPrototype, QLatin1String("some"), 2, 1); + addFunction(_arrayPrototype, QLatin1String("forEach"), 2, 1); + addFunction(_arrayPrototype, QLatin1String("map"), 2, 1); + addFunction(_arrayPrototype, QLatin1String("filter"), 2, 1); + addFunction(_arrayPrototype, QLatin1String("reduce"), 2, 1); + addFunction(_arrayPrototype, QLatin1String("reduceRight"), 2, 1); // set up the default String prototype - addFunction(_stringCtor, "fromCharCode", stringValue(), 0, 0, true); - - _stringPrototype->setMember("constructor", _stringCtor); - addFunction(_stringPrototype, "toString", stringValue(), 0); - addFunction(_stringPrototype, "valueOf", stringValue(), 0); - addFunction(_stringPrototype, "charAt", stringValue(), 1); - addFunction(_stringPrototype, "charCodeAt", stringValue(), 1); - addFunction(_stringPrototype, "concat", stringValue(), 0, 0, true); - addFunction(_stringPrototype, "indexOf", numberValue(), 2); - addFunction(_stringPrototype, "lastIndexOf", numberValue(), 2); - addFunction(_stringPrototype, "localeCompare", booleanValue(), 1); - addFunction(_stringPrototype, "match", arrayInstance, 1); - addFunction(_stringPrototype, "replace", stringValue(), 2); - addFunction(_stringPrototype, "search", numberValue(), 1); - addFunction(_stringPrototype, "slice", stringValue(), 2); - addFunction(_stringPrototype, "split", arrayInstance, 1); - addFunction(_stringPrototype, "substring", stringValue(), 2); - addFunction(_stringPrototype, "toLowerCase", stringValue(), 0); - addFunction(_stringPrototype, "toLocaleLowerCase", stringValue(), 0); - addFunction(_stringPrototype, "toUpperCase", stringValue(), 0); - addFunction(_stringPrototype, "toLocaleUpperCase", stringValue(), 0); - addFunction(_stringPrototype, "trim", stringValue(), 0); + addFunction(_stringCtor, QLatin1String("fromCharCode"), stringValue(), 0, 0, true); + + _stringPrototype->setMember(QLatin1String("constructor"), _stringCtor); + addFunction(_stringPrototype, QLatin1String("toString"), stringValue(), 0); + addFunction(_stringPrototype, QLatin1String("valueOf"), stringValue(), 0); + addFunction(_stringPrototype, QLatin1String("charAt"), stringValue(), 1); + addFunction(_stringPrototype, QLatin1String("charCodeAt"), stringValue(), 1); + addFunction(_stringPrototype, QLatin1String("concat"), stringValue(), 0, 0, true); + addFunction(_stringPrototype, QLatin1String("indexOf"), numberValue(), 2); + addFunction(_stringPrototype, QLatin1String("lastIndexOf"), numberValue(), 2); + addFunction(_stringPrototype, QLatin1String("localeCompare"), booleanValue(), 1); + addFunction(_stringPrototype, QLatin1String("match"), arrayInstance, 1); + addFunction(_stringPrototype, QLatin1String("replace"), stringValue(), 2); + addFunction(_stringPrototype, QLatin1String("search"), numberValue(), 1); + addFunction(_stringPrototype, QLatin1String("slice"), stringValue(), 2); + addFunction(_stringPrototype, QLatin1String("split"), arrayInstance, 1); + addFunction(_stringPrototype, QLatin1String("substring"), stringValue(), 2); + addFunction(_stringPrototype, QLatin1String("toLowerCase"), stringValue(), 0); + addFunction(_stringPrototype, QLatin1String("toLocaleLowerCase"), stringValue(), 0); + addFunction(_stringPrototype, QLatin1String("toUpperCase"), stringValue(), 0); + addFunction(_stringPrototype, QLatin1String("toLocaleUpperCase"), stringValue(), 0); + addFunction(_stringPrototype, QLatin1String("trim"), stringValue(), 0); // set up the default Boolean prototype - addFunction(_booleanCtor, "fromCharCode", 0); + addFunction(_booleanCtor, QLatin1String("fromCharCode"), 0); - _booleanPrototype->setMember("constructor", _booleanCtor); - addFunction(_booleanPrototype, "toString", stringValue(), 0); - addFunction(_booleanPrototype, "valueOf", booleanValue(), 0); + _booleanPrototype->setMember(QLatin1String("constructor"), _booleanCtor); + addFunction(_booleanPrototype, QLatin1String("toString"), stringValue(), 0); + addFunction(_booleanPrototype, QLatin1String("valueOf"), booleanValue(), 0); // set up the default Number prototype - _numberCtor->setMember("MAX_VALUE", numberValue()); - _numberCtor->setMember("MIN_VALUE", numberValue()); - _numberCtor->setMember("NaN", numberValue()); - _numberCtor->setMember("NEGATIVE_INFINITY", numberValue()); - _numberCtor->setMember("POSITIVE_INFINITY", numberValue()); - - addFunction(_numberCtor, "fromCharCode", 0); - - _numberPrototype->setMember("constructor", _numberCtor); - addFunction(_numberPrototype, "toString", stringValue(), 1, 1); - addFunction(_numberPrototype, "toLocaleString", stringValue(), 0); - addFunction(_numberPrototype, "valueOf", numberValue(), 0); - addFunction(_numberPrototype, "toFixed", numberValue(), 1); - addFunction(_numberPrototype, "toExponential", numberValue(), 1); - addFunction(_numberPrototype, "toPrecision", numberValue(), 1); + _numberCtor->setMember(QLatin1String("MAX_VALUE"), numberValue()); + _numberCtor->setMember(QLatin1String("MIN_VALUE"), numberValue()); + _numberCtor->setMember(QLatin1String("NaN"), numberValue()); + _numberCtor->setMember(QLatin1String("NEGATIVE_INFINITY"), numberValue()); + _numberCtor->setMember(QLatin1String("POSITIVE_INFINITY"), numberValue()); + + addFunction(_numberCtor, QLatin1String("fromCharCode"), 0); + + _numberPrototype->setMember(QLatin1String("constructor"), _numberCtor); + addFunction(_numberPrototype, QLatin1String("toString"), stringValue(), 1, 1); + addFunction(_numberPrototype, QLatin1String("toLocaleString"), stringValue(), 0); + addFunction(_numberPrototype, QLatin1String("valueOf"), numberValue(), 0); + addFunction(_numberPrototype, QLatin1String("toFixed"), numberValue(), 1); + addFunction(_numberPrototype, QLatin1String("toExponential"), numberValue(), 1); + addFunction(_numberPrototype, QLatin1String("toPrecision"), numberValue(), 1); // set up the Math object _mathObject = newObject(); - _mathObject->setMember("E", numberValue()); - _mathObject->setMember("LN10", numberValue()); - _mathObject->setMember("LN2", numberValue()); - _mathObject->setMember("LOG2E", numberValue()); - _mathObject->setMember("LOG10E", numberValue()); - _mathObject->setMember("PI", numberValue()); - _mathObject->setMember("SQRT1_2", numberValue()); - _mathObject->setMember("SQRT2", numberValue()); - - addFunction(_mathObject, "abs", numberValue(), 1); - addFunction(_mathObject, "acos", numberValue(), 1); - addFunction(_mathObject, "asin", numberValue(), 1); - addFunction(_mathObject, "atan", numberValue(), 1); - addFunction(_mathObject, "atan2", numberValue(), 2); - addFunction(_mathObject, "ceil", numberValue(), 1); - addFunction(_mathObject, "cos", numberValue(), 1); - addFunction(_mathObject, "exp", numberValue(), 1); - addFunction(_mathObject, "floor", numberValue(), 1); - addFunction(_mathObject, "log", numberValue(), 1); - addFunction(_mathObject, "max", numberValue(), 0, 0, true); - addFunction(_mathObject, "min", numberValue(), 0, 0, true); - addFunction(_mathObject, "pow", numberValue(), 2); - addFunction(_mathObject, "random", numberValue(), 1); - addFunction(_mathObject, "round", numberValue(), 1); - addFunction(_mathObject, "sin", numberValue(), 1); - addFunction(_mathObject, "sqrt", numberValue(), 1); - addFunction(_mathObject, "tan", numberValue(), 1); + _mathObject->setMember(QLatin1String("E"), numberValue()); + _mathObject->setMember(QLatin1String("LN10"), numberValue()); + _mathObject->setMember(QLatin1String("LN2"), numberValue()); + _mathObject->setMember(QLatin1String("LOG2E"), numberValue()); + _mathObject->setMember(QLatin1String("LOG10E"), numberValue()); + _mathObject->setMember(QLatin1String("PI"), numberValue()); + _mathObject->setMember(QLatin1String("SQRT1_2"), numberValue()); + _mathObject->setMember(QLatin1String("SQRT2"), numberValue()); + + addFunction(_mathObject, QLatin1String("abs"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("acos"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("asin"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("atan"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("atan2"), numberValue(), 2); + addFunction(_mathObject, QLatin1String("ceil"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("cos"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("exp"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("floor"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("log"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("max"), numberValue(), 0, 0, true); + addFunction(_mathObject, QLatin1String("min"), numberValue(), 0, 0, true); + addFunction(_mathObject, QLatin1String("pow"), numberValue(), 2); + addFunction(_mathObject, QLatin1String("random"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("round"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("sin"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("sqrt"), numberValue(), 1); + addFunction(_mathObject, QLatin1String("tan"), numberValue(), 1); // set up the default Boolean prototype - addFunction(_dateCtor, "parse", numberValue(), 1); - addFunction(_dateCtor, "UTC", numberValue(), 7, 5); - addFunction(_dateCtor, "now", numberValue(), 0); - - _datePrototype->setMember("constructor", _dateCtor); - addFunction(_datePrototype, "toString", stringValue(), 0); - addFunction(_datePrototype, "toDateString", stringValue(), 0); - addFunction(_datePrototype, "toTimeString", stringValue(), 0); - addFunction(_datePrototype, "toLocaleString", stringValue(), 0); - addFunction(_datePrototype, "toLocaleDateString", stringValue(), 0); - addFunction(_datePrototype, "toLocaleTimeString", stringValue(), 0); - addFunction(_datePrototype, "valueOf", numberValue(), 0); - addFunction(_datePrototype, "getTime", numberValue(), 0); - addFunction(_datePrototype, "getFullYear", numberValue(), 0); - addFunction(_datePrototype, "getUTCFullYear", numberValue(), 0); - addFunction(_datePrototype, "getMonth", numberValue(), 0); - addFunction(_datePrototype, "getUTCMonth", numberValue(), 0); - addFunction(_datePrototype, "getDate", numberValue(), 0); - addFunction(_datePrototype, "getUTCDate", numberValue(), 0); - addFunction(_datePrototype, "getHours", numberValue(), 0); - addFunction(_datePrototype, "getUTCHours", numberValue(), 0); - addFunction(_datePrototype, "getMinutes", numberValue(), 0); - addFunction(_datePrototype, "getUTCMinutes", numberValue(), 0); - addFunction(_datePrototype, "getSeconds", numberValue(), 0); - addFunction(_datePrototype, "getUTCSeconds", numberValue(), 0); - addFunction(_datePrototype, "getMilliseconds", numberValue(), 0); - addFunction(_datePrototype, "getUTCMilliseconds", numberValue(), 0); - addFunction(_datePrototype, "getTimezoneOffset", numberValue(), 0); - addFunction(_datePrototype, "setTime", 1); - addFunction(_datePrototype, "setMilliseconds", 1); - addFunction(_datePrototype, "setUTCMilliseconds", 1); - addFunction(_datePrototype, "setSeconds", 2, 1); - addFunction(_datePrototype, "setUTCSeconds", 2, 1); - addFunction(_datePrototype, "setMinutes", 3, 2); - addFunction(_datePrototype, "setUTCMinutes", 3, 2); - addFunction(_datePrototype, "setHours", 4, 3); - addFunction(_datePrototype, "setUTCHours", 4, 3); - addFunction(_datePrototype, "setDate", 1); - addFunction(_datePrototype, "setUTCDate", 1); - addFunction(_datePrototype, "setMonth", 2, 1); - addFunction(_datePrototype, "setUTCMonth", 2, 1); - addFunction(_datePrototype, "setFullYear", 3, 2); - addFunction(_datePrototype, "setUTCFullYear", 3, 2); - addFunction(_datePrototype, "toUTCString", stringValue(), 0); - addFunction(_datePrototype, "toISOString", stringValue(), 0); - addFunction(_datePrototype, "toJSON", stringValue(), 1); + addFunction(_dateCtor, QLatin1String("parse"), numberValue(), 1); + addFunction(_dateCtor, QLatin1String("UTC"), numberValue(), 7, 5); + addFunction(_dateCtor, QLatin1String("now"), numberValue(), 0); + + _datePrototype->setMember(QLatin1String("constructor"), _dateCtor); + addFunction(_datePrototype, QLatin1String("toString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toDateString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toTimeString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toLocaleString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toLocaleDateString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toLocaleTimeString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("valueOf"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getTime"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getFullYear"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCFullYear"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getMonth"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCMonth"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getDate"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCDate"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getHours"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCHours"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getMinutes"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCMinutes"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getSeconds"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCSeconds"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getMilliseconds"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getUTCMilliseconds"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("getTimezoneOffset"), numberValue(), 0); + addFunction(_datePrototype, QLatin1String("setTime"), 1); + addFunction(_datePrototype, QLatin1String("setMilliseconds"), 1); + addFunction(_datePrototype, QLatin1String("setUTCMilliseconds"), 1); + addFunction(_datePrototype, QLatin1String("setSeconds"), 2, 1); + addFunction(_datePrototype, QLatin1String("setUTCSeconds"), 2, 1); + addFunction(_datePrototype, QLatin1String("setMinutes"), 3, 2); + addFunction(_datePrototype, QLatin1String("setUTCMinutes"), 3, 2); + addFunction(_datePrototype, QLatin1String("setHours"), 4, 3); + addFunction(_datePrototype, QLatin1String("setUTCHours"), 4, 3); + addFunction(_datePrototype, QLatin1String("setDate"), 1); + addFunction(_datePrototype, QLatin1String("setUTCDate"), 1); + addFunction(_datePrototype, QLatin1String("setMonth"), 2, 1); + addFunction(_datePrototype, QLatin1String("setUTCMonth"), 2, 1); + addFunction(_datePrototype, QLatin1String("setFullYear"), 3, 2); + addFunction(_datePrototype, QLatin1String("setUTCFullYear"), 3, 2); + addFunction(_datePrototype, QLatin1String("toUTCString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toISOString"), stringValue(), 0); + addFunction(_datePrototype, QLatin1String("toJSON"), stringValue(), 1); // set up the default Boolean prototype - _regexpPrototype->setMember("constructor", _regexpCtor); - addFunction(_regexpPrototype, "exec", arrayInstance, 1); - addFunction(_regexpPrototype, "test", booleanValue(), 1); - addFunction(_regexpPrototype, "toString", stringValue(), 0); + _regexpPrototype->setMember(QLatin1String("constructor"), _regexpCtor); + addFunction(_regexpPrototype, QLatin1String("exec"), arrayInstance, 1); + addFunction(_regexpPrototype, QLatin1String("test"), booleanValue(), 1); + addFunction(_regexpPrototype, QLatin1String("toString"), stringValue(), 0); // fill the Global object - _globalObject->setMember("Math", _mathObject); - _globalObject->setMember("Object", objectCtor()); - _globalObject->setMember("Function", functionCtor()); - _globalObject->setMember("Array", arrayCtor()); - _globalObject->setMember("String", stringCtor()); - _globalObject->setMember("Boolean", booleanCtor()); - _globalObject->setMember("Number", numberCtor()); - _globalObject->setMember("Date", dateCtor()); - _globalObject->setMember("RegExp", regexpCtor()); + _globalObject->setMember(QLatin1String("Math"), _mathObject); + _globalObject->setMember(QLatin1String("Object"), objectCtor()); + _globalObject->setMember(QLatin1String("Function"), functionCtor()); + _globalObject->setMember(QLatin1String("Array"), arrayCtor()); + _globalObject->setMember(QLatin1String("String"), stringCtor()); + _globalObject->setMember(QLatin1String("Boolean"), booleanCtor()); + _globalObject->setMember(QLatin1String("Number"), numberCtor()); + _globalObject->setMember(QLatin1String("Date"), dateCtor()); + _globalObject->setMember(QLatin1String("RegExp"), regexpCtor()); Function *f = 0; // XMLHttpRequest ObjectValue *xmlHttpRequest = newObject(); - xmlHttpRequest->setMember("onreadystatechange", functionPrototype()); - xmlHttpRequest->setMember("UNSENT", numberValue()); - xmlHttpRequest->setMember("OPENED", numberValue()); - xmlHttpRequest->setMember("HEADERS_RECEIVED", numberValue()); - xmlHttpRequest->setMember("LOADING", numberValue()); - xmlHttpRequest->setMember("DONE", numberValue()); - xmlHttpRequest->setMember("readyState", numberValue()); - f = addFunction(xmlHttpRequest, "open"); - f->addArgument(stringValue(), "method"); - f->addArgument(stringValue(), "url"); - f->addArgument(booleanValue(), "async"); - f->addArgument(stringValue(), "user"); - f->addArgument(stringValue(), "password"); - f = addFunction(xmlHttpRequest, "setRequestHeader"); - f->addArgument(stringValue(), "header"); - f->addArgument(stringValue(), "value"); - f = addFunction(xmlHttpRequest, "send"); - f->addArgument(unknownValue(), "data"); - f = addFunction(xmlHttpRequest, "abort"); - xmlHttpRequest->setMember("status", numberValue()); - xmlHttpRequest->setMember("statusText", stringValue()); - f = addFunction(xmlHttpRequest, "getResponseHeader"); - f->addArgument(stringValue(), "header"); - f = addFunction(xmlHttpRequest, "getAllResponseHeaders"); - xmlHttpRequest->setMember("responseText", stringValue()); - xmlHttpRequest->setMember("responseXML", unknownValue()); - - f = addFunction(_globalObject, "XMLHttpRequest", xmlHttpRequest); - f->setMember("prototype", xmlHttpRequest); - xmlHttpRequest->setMember("constructor", f); + xmlHttpRequest->setMember(QLatin1String("onreadystatechange"), functionPrototype()); + xmlHttpRequest->setMember(QLatin1String("UNSENT"), numberValue()); + xmlHttpRequest->setMember(QLatin1String("OPENED"), numberValue()); + xmlHttpRequest->setMember(QLatin1String("HEADERS_RECEIVED"), numberValue()); + xmlHttpRequest->setMember(QLatin1String("LOADING"), numberValue()); + xmlHttpRequest->setMember(QLatin1String("DONE"), numberValue()); + xmlHttpRequest->setMember(QLatin1String("readyState"), numberValue()); + f = addFunction(xmlHttpRequest, QLatin1String("open")); + f->addArgument(stringValue(), QLatin1String("method")); + f->addArgument(stringValue(), QLatin1String("url")); + f->addArgument(booleanValue(), QLatin1String("async")); + f->addArgument(stringValue(), QLatin1String("user")); + f->addArgument(stringValue(), QLatin1String("password")); + f = addFunction(xmlHttpRequest, QLatin1String("setRequestHeader")); + f->addArgument(stringValue(), QLatin1String("header")); + f->addArgument(stringValue(), QLatin1String("value")); + f = addFunction(xmlHttpRequest, QLatin1String("send")); + f->addArgument(unknownValue(), QLatin1String("data")); + f = addFunction(xmlHttpRequest, QLatin1String("abort")); + xmlHttpRequest->setMember(QLatin1String("status"), numberValue()); + xmlHttpRequest->setMember(QLatin1String("statusText"), stringValue()); + f = addFunction(xmlHttpRequest, QLatin1String("getResponseHeader")); + f->addArgument(stringValue(), QLatin1String("header")); + f = addFunction(xmlHttpRequest, QLatin1String("getAllResponseHeaders")); + xmlHttpRequest->setMember(QLatin1String("responseText"), stringValue()); + xmlHttpRequest->setMember(QLatin1String("responseXML"), unknownValue()); + + f = addFunction(_globalObject, QLatin1String("XMLHttpRequest"), xmlHttpRequest); + f->setMember(QLatin1String("prototype"), xmlHttpRequest); + xmlHttpRequest->setMember(QLatin1String("constructor"), f); // Database API ObjectValue *db = newObject(); - f = addFunction(db, "transaction"); - f->addArgument(functionPrototype(), "callback"); - f = addFunction(db, "readTransaction"); - f->addArgument(functionPrototype(), "callback"); - f->setMember("version", stringValue()); - f = addFunction(db, "changeVersion"); - f->addArgument(stringValue(), "oldVersion"); - f->addArgument(stringValue(), "newVersion"); - f->addArgument(functionPrototype(), "callback"); - - f = addFunction(_globalObject, "openDatabaseSync", db); - f->addArgument(stringValue(), "name"); - f->addArgument(stringValue(), "version"); - f->addArgument(stringValue(), "displayName"); - f->addArgument(numberValue(), "estimatedSize"); - f->addArgument(functionPrototype(), "callback"); + f = addFunction(db, QLatin1String("transaction")); + f->addArgument(functionPrototype(), QLatin1String("callback")); + f = addFunction(db, QLatin1String("readTransaction")); + f->addArgument(functionPrototype(), QLatin1String("callback")); + f->setMember(QLatin1String("version"), stringValue()); + f = addFunction(db, QLatin1String("changeVersion")); + f->addArgument(stringValue(), QLatin1String("oldVersion")); + f->addArgument(stringValue(), QLatin1String("newVersion")); + f->addArgument(functionPrototype(), QLatin1String("callback")); + + f = addFunction(_globalObject, QLatin1String("openDatabaseSync"), db); + f->addArgument(stringValue(), QLatin1String("name")); + f->addArgument(stringValue(), QLatin1String("version")); + f->addArgument(stringValue(), QLatin1String("displayName")); + f->addArgument(numberValue(), QLatin1String("estimatedSize")); + f->addArgument(functionPrototype(), QLatin1String("callback")); // JSON ObjectValue *json = newObject(); - f = addFunction(json, "parse", objectPrototype()); - f->addArgument(stringValue(), "text"); - f->addArgument(functionPrototype(), "reviver"); + f = addFunction(json, QLatin1String("parse"), objectPrototype()); + f->addArgument(stringValue(), QLatin1String("text")); + f->addArgument(functionPrototype(), QLatin1String("reviver")); f->setOptionalNamedArgumentCount(1); - f = addFunction(json, "stringify", stringValue()); - f->addArgument(unknownValue(), "value"); - f->addArgument(unknownValue(), "replacer"); - f->addArgument(unknownValue(), "space"); + f = addFunction(json, QLatin1String("stringify"), stringValue()); + f->addArgument(unknownValue(), QLatin1String("value")); + f->addArgument(unknownValue(), QLatin1String("replacer")); + f->addArgument(unknownValue(), QLatin1String("space")); f->setOptionalNamedArgumentCount(2); - _globalObject->setMember("JSON", json); + _globalObject->setMember(QLatin1String("JSON"), json); // QML objects _qmlFontObject = newObject(/*prototype =*/ 0); _qmlFontObject->setClassName(QLatin1String("Font")); - _qmlFontObject->setMember("family", stringValue()); - _qmlFontObject->setMember("weight", unknownValue()); // ### make me an object - _qmlFontObject->setMember("capitalization", unknownValue()); // ### make me an object - _qmlFontObject->setMember("bold", booleanValue()); - _qmlFontObject->setMember("italic", booleanValue()); - _qmlFontObject->setMember("underline", booleanValue()); - _qmlFontObject->setMember("overline", booleanValue()); - _qmlFontObject->setMember("strikeout", booleanValue()); - _qmlFontObject->setMember("pointSize", intValue()); - _qmlFontObject->setMember("pixelSize", intValue()); - _qmlFontObject->setMember("letterSpacing", realValue()); - _qmlFontObject->setMember("wordSpacing", realValue()); + _qmlFontObject->setMember(QLatin1String("family"), stringValue()); + _qmlFontObject->setMember(QLatin1String("weight"), unknownValue()); // ### make me an object + _qmlFontObject->setMember(QLatin1String("capitalization"), unknownValue()); // ### make me an object + _qmlFontObject->setMember(QLatin1String("bold"), booleanValue()); + _qmlFontObject->setMember(QLatin1String("italic"), booleanValue()); + _qmlFontObject->setMember(QLatin1String("underline"), booleanValue()); + _qmlFontObject->setMember(QLatin1String("overline"), booleanValue()); + _qmlFontObject->setMember(QLatin1String("strikeout"), booleanValue()); + _qmlFontObject->setMember(QLatin1String("pointSize"), intValue()); + _qmlFontObject->setMember(QLatin1String("pixelSize"), intValue()); + _qmlFontObject->setMember(QLatin1String("letterSpacing"), realValue()); + _qmlFontObject->setMember(QLatin1String("wordSpacing"), realValue()); _qmlPointObject = newObject(/*prototype =*/ 0); _qmlPointObject->setClassName(QLatin1String("Point")); - _qmlPointObject->setMember("x", numberValue()); - _qmlPointObject->setMember("y", numberValue()); + _qmlPointObject->setMember(QLatin1String("x"), numberValue()); + _qmlPointObject->setMember(QLatin1String("y"), numberValue()); _qmlSizeObject = newObject(/*prototype =*/ 0); _qmlSizeObject->setClassName(QLatin1String("Size")); - _qmlSizeObject->setMember("width", numberValue()); - _qmlSizeObject->setMember("height", numberValue()); + _qmlSizeObject->setMember(QLatin1String("width"), numberValue()); + _qmlSizeObject->setMember(QLatin1String("height"), numberValue()); _qmlRectObject = newObject(/*prototype =*/ 0); - _qmlRectObject->setClassName("Rect"); - _qmlRectObject->setMember("x", numberValue()); - _qmlRectObject->setMember("y", numberValue()); - _qmlRectObject->setMember("width", numberValue()); - _qmlRectObject->setMember("height", numberValue()); + _qmlRectObject->setClassName(QLatin1String("Rect")); + _qmlRectObject->setMember(QLatin1String("x"), numberValue()); + _qmlRectObject->setMember(QLatin1String("y"), numberValue()); + _qmlRectObject->setMember(QLatin1String("width"), numberValue()); + _qmlRectObject->setMember(QLatin1String("height"), numberValue()); _qmlVector3DObject = newObject(/*prototype =*/ 0); _qmlVector3DObject->setClassName(QLatin1String("Vector3D")); - _qmlVector3DObject->setMember("x", realValue()); - _qmlVector3DObject->setMember("y", realValue()); - _qmlVector3DObject->setMember("z", realValue()); + _qmlVector3DObject->setMember(QLatin1String("x"), realValue()); + _qmlVector3DObject->setMember(QLatin1String("y"), realValue()); + _qmlVector3DObject->setMember(QLatin1String("z"), realValue()); // global Qt object, in alphabetic order _qtObject = newObject(new QtObjectPrototypeReference(this)); |