Browse Source

Expose QBuffer::data() to host environment

Neal Wilson 7 years ago
parent
commit
98de8a75b6
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      src/typica.w

+ 8
- 0
src/typica.w View File

2856
 QScriptValue constructQBuffer(QScriptContext *context, QScriptEngine *engine);
2856
 QScriptValue constructQBuffer(QScriptContext *context, QScriptEngine *engine);
2857
 void setQBufferProperties(QScriptValue value, QScriptEngine *engine);
2857
 void setQBufferProperties(QScriptValue value, QScriptEngine *engine);
2858
 QScriptValue QBuffer_setData(QScriptContext *context, QScriptEngine *engine);
2858
 QScriptValue QBuffer_setData(QScriptContext *context, QScriptEngine *engine);
2859
+QScriptValue QBuffer_data(QScriptContext *context, QScriptEngine *engine);
2859
 
2860
 
2860
 @ The host environment needs to be aware of the constructor.
2861
 @ The host environment needs to be aware of the constructor.
2861
 
2862
 
2879
 {
2880
 {
2880
     setQIODeviceProperties(value, engine);
2881
     setQIODeviceProperties(value, engine);
2881
     value.setProperty("setData", engine->newFunction(QBuffer_setData));
2882
     value.setProperty("setData", engine->newFunction(QBuffer_setData));
2883
+    value.setProperty("data", engine->newFunction(QBuffer_data));
2882
 }
2884
 }
2883
 
2885
 
2884
 QScriptValue QBuffer_setData(QScriptContext *context, QScriptEngine *)
2886
 QScriptValue QBuffer_setData(QScriptContext *context, QScriptEngine *)
2888
     return QScriptValue();
2890
     return QScriptValue();
2889
 }
2891
 }
2890
 
2892
 
2893
+QScriptValue QBuffer_data(QScriptContext *context, QScriptEngine *)
2894
+{
2895
+    QBuffer *self = getself<QBuffer *>(context);
2896
+    return QScriptValue(QString(self->data()));
2897
+}
2898
+
2891
 @* Scripting QXmlQuery.
2899
 @* Scripting QXmlQuery.
2892
 
2900
 
2893
 \noindent Sometimes we have some XML data in a file or a buffer and we would
2901
 \noindent Sometimes we have some XML data in a file or a buffer and we would

Loading…
Cancel
Save