55 #include "DataTypeWrapper.hh" 59 QScriptValue toScriptValueDataType(QScriptEngine *engine,
const DataType &s)
61 QScriptValue obj = engine->newObject();
62 obj.setProperty(
"type", QScriptValue(engine, s.
value() ));
66 void fromScriptValueDataType(
const QScriptValue &obj,
DataType &s)
68 s = obj.property(
"type").toNumber();
71 QScriptValue createDataType(QScriptContext *context, QScriptEngine *engine)
75 QScriptValue callee = context->callee();
79 if (context->argumentCount() == 1) {
80 QVariant argument = context->argument(0).toVariant();
84 s = argument.toUInt(&ok);
88 s =
typeId(argument.toString());
95 return engine->toScriptValue( s );
98 QScriptValue DataTypeToString(QScriptContext *context, QScriptEngine *engine)
100 DataType s = context->thisObject().property(
"type").toNumber();
102 return QScriptValue(engine,
typeName(s) );
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
const DataType DATA_UNKNOWN(0)
None of the other Objects.
unsigned int value() const
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.