Parcourir la source

invalidate property added to QXmlQuery script binding

Neal Wilson il y a 11 ans
Parent
révision
d9ea878e73
2 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 1
    0
      config/Windows/batchdetailsnew.xml
  2. 10
    1
      src/typica.w

+ 1
- 0
config/Windows/batchdetailsnew.xml Voir le fichier

@@ -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 Voir le fichier

@@ -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

Chargement…
Annuler
Enregistrer