|
@@ -1872,6 +1872,9 @@ QScriptValue QIODevice_readToString(QScriptContext *context,
|
1872
|
1872
|
QScriptValue QIODevice_putChar(QScriptContext *context, QScriptEngine *engine);
|
1873
|
1873
|
QScriptValue QIODevice_writeString(QScriptContext *context, QScriptEngine *engine);
|
1874
|
1874
|
QScriptValue QIODevice_writeBytes(QScriptContext *context, QScriptEngine *engine);
|
|
1875
|
+QScriptValue QIODevice_readBytes(QScriptContext *context, QScriptEngine *engine);
|
|
1876
|
+QScriptValue QIODevice_peek(QScriptContext *context, QScriptEngine *engine);
|
|
1877
|
+QScriptValue QIODevice_read(QScriptContext *context, QScriptEngine *engine);
|
1875
|
1878
|
|
1876
|
1879
|
@ This function is passed to the scripting engine.
|
1877
|
1880
|
|
|
@@ -1926,6 +1929,9 @@ void setQIODeviceProperties(QScriptValue value, QScriptEngine *engine)
|
1926
|
1929
|
value.setProperty("putChar", engine->newFunction(QIODevice_putChar));
|
1927
|
1930
|
value.setProperty("writeString", engine->newFunction(QIODevice_writeString));
|
1928
|
1931
|
value.setProperty("writeBytes", engine->newFunction(QIODevice_writeBytes));
|
|
1932
|
+ value.setProperty("readBytes", engine->newFunction(QIODevice_readBytes));
|
|
1933
|
+ value.setProperty("peek", engine->newFunction(QIODevice_peek));
|
|
1934
|
+ value.setProperty("read", engine->newFunction(QIODevice_read));
|
1929
|
1935
|
}
|
1930
|
1936
|
|
1931
|
1937
|
@ These are simple wrappers. In the case of the |open()| property, one argument
|
|
@@ -2038,6 +2044,33 @@ QScriptValue QIODevice_writeBytes(QScriptContext *context, QScriptEngine *)
|
2038
|
2044
|
return QScriptValue();
|
2039
|
2045
|
}
|
2040
|
2046
|
|
|
2047
|
+@ The readBytes method is an alternate wrapper around |QByteArray::readAll()|
|
|
2048
|
+which returns the |QByteArray| instead of converting this to a |QString|.
|
|
2049
|
+
|
|
2050
|
+@<Functions for scripting@>=
|
|
2051
|
+QScriptValue QIODevice_readBytes(QScriptContext *context, QScriptEngine *engine)
|
|
2052
|
+{
|
|
2053
|
+ QIODevice *self = getself<QIODevice *>(context);
|
|
2054
|
+ return QScriptValue(engine->toScriptValue<QByteArray>(self->readAll()));
|
|
2055
|
+}
|
|
2056
|
+
|
|
2057
|
+@ Wrappers around |peek()| and |read()| are also provided.
|
|
2058
|
+
|
|
2059
|
+@<Functions for scripting@>=
|
|
2060
|
+QScriptValue QIODevice_peek(QScriptContext *context, QScriptEngine *engine)
|
|
2061
|
+{
|
|
2062
|
+ QIODevice *self = getself<QIODevice *>(context);
|
|
2063
|
+ return QScriptValue(engine->toScriptValue<QByteArray>(
|
|
2064
|
+ self->peek(argument<int>(0, context))));
|
|
2065
|
+}
|
|
2066
|
+
|
|
2067
|
+QScriptValue QIODevice_read(QScriptContext *context, QScriptEngine *engine)
|
|
2068
|
+{
|
|
2069
|
+ QIODevice *self = getself<QIODevice *>(context);
|
|
2070
|
+ return QScriptValue(engine->toScriptValue<QByteArray>(
|
|
2071
|
+ self->read(argument<int>(0, context))));
|
|
2072
|
+}
|
|
2073
|
+
|
2041
|
2074
|
@ In order to work with |QByteArray| this should also be exposed to the host
|
2042
|
2075
|
environment.
|
2043
|
2076
|
|