浏览代码

invalidate property added to QXmlQuery script binding

Neal Wilson 10 年前
父节点
当前提交
d9ea878e73
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 1
    0
      config/Windows/batchdetailsnew.xml
  2. 10
    1
      src/typica.w

+ 1
- 0
config/Windows/batchdetailsnew.xml 查看文件

@@ -295,6 +295,7 @@
295 295
 				rq = rq + 'string($t/annotation), "~")';
296 296
 				colQuery.setQuery(rq);
297 297
 				var annotationData = colQuery.exec();
298
+				colQuery = colQuery.invalidate();
298 299
 				buffer2.close();
299 300
 				output.writeStartElement("tbody");
300 301
 				var annotationRecords = annotationData.split("~");

+ 10
- 1
src/typica.w 查看文件

@@ -2256,6 +2256,7 @@ QScriptValue constructXQuery(QScriptContext *context, QScriptEngine *engine);
2256 2256
 QScriptValue XQuery_bind(QScriptContext *context, QScriptEngine *engine);
2257 2257
 QScriptValue XQuery_exec(QScriptContext *context, QScriptEngine *engine);
2258 2258
 QScriptValue XQuery_setQuery(QScriptContext *context, QScriptEngine *engine);
2259
+QScriptValue XQuery_invalidate(QScriptContext *context, QScriptEngine *engine);
2259 2260
 void setXQueryProperties(QScriptValue value, QScriptEngine *engine);
2260 2261
 
2261 2262
 @ The constructor must be registered with the host environment. This is done a
@@ -2266,7 +2267,7 @@ constructor = engine->newFunction(constructXQuery);
2266 2267
 engine->globalObject().setProperty("XQuery", constructor);
2267 2268
 
2268 2269
 @ The constructor just needs to make sure the functions we want to make
2269
-available are applied.
2270
+available are applied. A method is also provided to free the |QXmlQuery|.
2270 2271
 
2271 2272
 @<Functions for scripting@>=
2272 2273
 QScriptValue constructXQuery(QScriptContext *, QScriptEngine *engine)
@@ -2276,11 +2277,19 @@ QScriptValue constructXQuery(QScriptContext *, QScriptEngine *engine)
2276 2277
 	return object;
2277 2278
 }
2278 2279
 
2280
+QScriptValue XQuery_invalidate(QScriptContext *context, QScriptEngine *)
2281
+{
2282
+	QXmlQuery *self = getself<QXmlQuery *>(context);
2283
+	delete self;
2284
+	return QScriptValue();
2285
+}
2286
+
2279 2287
 void setXQueryProperties(QScriptValue value, QScriptEngine *engine)
2280 2288
 {
2281 2289
 	value.setProperty("bind", engine->newFunction(XQuery_bind));
2282 2290
 	value.setProperty("exec", engine->newFunction(XQuery_exec));
2283 2291
 	value.setProperty("setQuery", engine->newFunction(XQuery_setQuery));
2292
+	value.setProperty("invalidate", engine->newFunction(XQuery_invalidate));
2284 2293
 }
2285 2294
 
2286 2295
 @ The |bind()| property can be used to specify a |QIODevice| to be referenced by

正在加载...
取消
保存