61 #include "DataTypeWrapper.hh"
65 QScriptValue toScriptValueDataType(QScriptEngine *engine,
const DataType &s)
67 QScriptValue obj = engine->newObject();
68 obj.setProperty(
"type", QScriptValue(engine, s.
value() ));
72 void fromScriptValueDataType(
const QScriptValue &obj,
DataType &s)
74 s = obj.property(
"type").toNumber();
77 QScriptValue createDataType(QScriptContext *context, QScriptEngine *engine)
81 QScriptValue callee = context->callee();
85 if (context->argumentCount() == 1) {
86 QVariant argument = context->argument(0).toVariant();
90 s = argument.toUInt(&ok);
94 s =
typeId(argument.toString());
101 return engine->toScriptValue( s );
104 QScriptValue DataTypeToString(QScriptContext *context, QScriptEngine *engine)
106 DataType s = context->thisObject().property(
"type").toNumber();
108 return QScriptValue(engine,
typeName(s) );
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
const DataType DATA_UNKNOWN(0)
None of the other Objects.
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
unsigned int value() const