summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-06-10 22:47:14 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-06-10 22:47:14 (GMT)
commit6f56474450b7c54f2c95b5dea6a7a42623141649 (patch)
tree420c52085d8cf778360c09baf9722b21d01259da
parenta154682fc1b25581742d38dd5fe9aa06ede167b7 (diff)
downloaduscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.zip
uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.tar.gz
uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.tar.bz2
W3C MMI Architecture framework
-rw-r--r--CMakeLists.txt22
-rw-r--r--apps/samples/map/map.html30
-rw-r--r--apps/samples/map/map.js158
-rw-r--r--apps/samples/vrml.zipbin0 -> 117742 bytes
-rw-r--r--apps/samples/vrml/img/Tutorial.pngbin0 -> 34969 bytes
-rw-r--r--apps/samples/vrml/img/Tutorial.pxmbin0 -> 123387 bytes
-rw-r--r--apps/samples/vrml/img/drag.pngbin0 -> 3543 bytes
-rw-r--r--apps/samples/vrml/img/drag2.pngbin0 -> 509 bytes
-rw-r--r--apps/samples/vrml/img/drag3.pngbin0 -> 186 bytes
-rw-r--r--apps/samples/vrml/img/pitchRoll.pngbin0 -> 913 bytes
-rw-r--r--apps/samples/vrml/img/pitchRoll3.pngbin0 -> 3596 bytes
-rw-r--r--apps/samples/vrml/img/xy.pngbin0 -> 746 bytes
-rw-r--r--apps/samples/vrml/img/xy2.pngbin0 -> 820 bytes
-rw-r--r--apps/samples/vrml/img/yawZoom.pngbin0 -> 2252 bytes
-rw-r--r--apps/samples/vrml/viewer.html33
-rw-r--r--apps/samples/vrml/viewer.js572
-rw-r--r--apps/uscxml-browser.cpp (renamed from apps/mmi-browser.cpp)18
-rw-r--r--apps/uscxml-browser.vbs (renamed from apps/mmi-browser.vbs)0
-rw-r--r--apps/w3c-mmi/MMIEventServlet.cpp210
-rw-r--r--apps/w3c-mmi/MMIEventServlet.h59
-rw-r--r--apps/w3c-mmi/im/MMISessionManager.cpp257
-rw-r--r--apps/w3c-mmi/im/MMISessionManager.h81
-rw-r--r--apps/w3c-mmi/im/uscxml-interaction-manager.cpp182
-rw-r--r--apps/w3c-mmi/mc/uscxml-modality-component.cpp191
-rw-r--r--contrib/dom/idl/Node.idl2
-rwxr-xr-xcontrib/local/compress_and_upload_deps.sh6
-rw-r--r--docs/BUILDING.md2
-rw-r--r--src/uscxml/Factory.cpp147
-rw-r--r--src/uscxml/Factory.h108
-rw-r--r--src/uscxml/Interpreter.cpp80
-rw-r--r--src/uscxml/Interpreter.h38
-rw-r--r--src/uscxml/Message.h27
-rw-r--r--src/uscxml/NameSpacingParser.cpp44
-rw-r--r--src/uscxml/NameSpacingParser.h26
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp9
-rw-r--r--src/uscxml/interpreter/InterpreterDraft7.cpp7
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp84
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h88
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp144
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h106
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp558
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h170
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp112
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h98
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp418
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h158
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp42
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h80
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp258
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp579
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h250
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp31
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp54
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h58
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h82
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h56
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h58
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h120
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h50
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp104
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h108
-rw-r--r--src/uscxml/plugins/element/CMakeLists.txt17
-rw-r--r--src/uscxml/plugins/element/fetch/FetchElement.cpp6
-rw-r--r--src/uscxml/plugins/element/mmi/MMIEvents.cpp42
-rw-r--r--src/uscxml/plugins/element/mmi/MMIEvents.h58
-rw-r--r--src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp2
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h2
-rw-r--r--src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h2
-rw-r--r--src/uscxml/plugins/invoker/system/SystemInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/system/SystemInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h4
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp12
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIComponent.h34
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp188
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h53
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h12
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp196
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.h327
-rw-r--r--src/uscxml/server/HTTPServer.cpp5
-rw-r--r--src/uscxml/server/HTTPServer.h4
-rw-r--r--test/samples/uscxml/templates/mc-html.html161
-rw-r--r--test/samples/uscxml/test-mmi-events.scxml88
-rw-r--r--test/samples/uscxml/test-mmi-im.scxml69
-rw-r--r--test/samples/uscxml/test-mmi-mc.scxml83
119 files changed, 5410 insertions, 2944 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a07668c..afcb956 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -510,10 +510,24 @@ else()
target_link_libraries(uscxml ${USCXML_OPT_LIBS} ${USCXML_CORE_LIBS})
endif()
-add_executable(mmi-browser apps/mmi-browser.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/XGetopt.cpp)
-target_link_libraries(mmi-browser uscxml)
-set_target_properties(mmi-browser PROPERTIES FOLDER "Apps")
-install_executable(TARGETS mmi-browser COMPONENT tools)
+add_executable(uscxml-browser apps/uscxml-browser.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/XGetopt.cpp)
+target_link_libraries(uscxml-browser uscxml)
+set_target_properties(uscxml-browser PROPERTIES FOLDER "Apps")
+install_executable(TARGETS uscxml-browser COMPONENT tools)
+
+file(GLOB W3C-MMI-COMMON ${PROJECT_SOURCE_DIR}/apps/w3c-mmi/*.cpp ${PROJECT_SOURCE_DIR}/apps/w3c-mmi/*.h)
+
+file(GLOB_RECURSE W3C-MMI-IM ${PROJECT_SOURCE_DIR}/apps/w3c-mmi/im/*.cpp ${PROJECT_SOURCE_DIR}/apps/w3c-mmi/im/*.h)
+add_executable(uscxml-interaction-manager ${W3C-MMI-IM} ${W3C-MMI-COMMON})
+target_link_libraries(uscxml-interaction-manager uscxml)
+set_target_properties(uscxml-interaction-manager PROPERTIES FOLDER "Apps")
+install_executable(TARGETS uscxml-interaction-manager COMPONENT tools)
+
+file(GLOB_RECURSE W3C-MMI-MC ${PROJECT_SOURCE_DIR}/apps/w3c-mmi/mc/*.cpp ${PROJECT_SOURCE_DIR}/apps/w3c-mmi/mc/*.h)
+add_executable(uscxml-modality-component ${W3C-MMI-MC} ${W3C-MMI-COMMON})
+target_link_libraries(uscxml-modality-component uscxml)
+set_target_properties(uscxml-modality-component PROPERTIES FOLDER "Apps")
+install_executable(TARGETS uscxml-modality-component COMPONENT tools)
if (BUILD_TESTS)
add_subdirectory(test)
diff --git a/apps/samples/map/map.html b/apps/samples/map/map.html
new file mode 100644
index 0000000..01dc92b
--- /dev/null
+++ b/apps/samples/map/map.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/tundra/tundra.css">
+ <!-- link rel="stylesheet" href="map.css" -->
+ <script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
+ <style type="text/css">
+ </style>
+
+ <script type="text/javascript">
+ </script>
+
+ <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js"></script>
+ <script type="text/javascript" src="map.js"></script>
+
+ <script type="text/javascript">
+ require(["dojo/domReady!", "dojo"], function(dom, dojo) {
+ var map = new Map("map");
+ });
+ </script>
+ </head>
+ <body class="tundra">
+ <table>
+ <tr><td>
+ <div id="map" />
+ </td></tr>
+ </table>
+ </body>
+</html>
diff --git a/apps/samples/map/map.js b/apps/samples/map/map.js
new file mode 100644
index 0000000..6794875
--- /dev/null
+++ b/apps/samples/map/map.js
@@ -0,0 +1,158 @@
+function Map(element) {
+
+ // private attributes
+ var self = this;
+
+ // private instanceId
+ if (!Map.instances)
+ Map.instances = 0;
+ var instanceId = Map.instances++;
+
+ // public attributes
+ this.coords = {};
+
+
+ require([
+ "dojo/ready",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dojo/dom",
+ "dojox/geo/openlayers/Map",
+ "dojox/geo/openlayers/GfxLayer",
+ "dojox/geo/openlayers/Layer",
+ "dojox/geo/openlayers/GeometryFeature",
+ "dojox/geo/openlayers/Point",
+ "dojox/geo/openlayers/LineString",
+ "dojox/geo/openlayers/WidgetFeature",
+ "dojox/charting/widget/Chart",
+ "dojox/charting/widget/Chart2D",
+ "dojox/charting/plot2d/Pie",
+ "dojox/charting/themes/PlotKit/blue"
+ ], function(
+ ready,
+ domConstruct,
+ win,
+ dom,
+ Map,
+ GfxLayer,
+ Layer,
+ GeometryFeature,
+ Point,
+ LineString,
+ WidgetFeature,
+ Chart,
+ Chart2D,
+ Pie,
+ blue
+ ) {
+ ready(function(){
+
+ if (typeof(element) === 'string') {
+ element = dom.byId(element);
+ }
+
+ element.style.width = "450px";
+ element.style.height = "350px";
+
+ var options = {
+ baseLayerName: "WorldMap",
+ baseLayerType : dojox.geo.openlayers.BaseLayerType.OSM,
+ //baseLayerUrl: "http://localhost/mapserver/mapserv.cgi?map=./world.map",
+ baseLayerOptions: {
+ layers: ['contry','state','city','town','highway']
+ },
+ touchHandler: false,
+ accessible: true
+ };
+
+ // Available base layers: http://dojotoolkit.org/reference-guide/1.7/dojox/geo/openlayers.html#id5
+ self.map = new Map(element, options);
+
+ // This is New York location
+ var ny = {
+ latitude : 49.877648,
+ longitude : 8.654762
+ };
+
+ var people = [ {
+ name : 'Dirk',
+ y : 49.877848,
+ x : 8.653762
+ }, {
+ name : 'Stefan',
+ y : 49.877348,
+ x : 8.655462
+ } ];
+
+ var div = domConstruct.create("div", {}, win.body());
+ //var div = domConstruct.create("div", {});
+ var chart = new Chart({
+ margins : {
+ l : 0,
+ r : 0,
+ t : 0,
+ b : 0
+ }
+ }, div);
+
+ var c = chart.chart;
+ c.addPlot("default", {
+ type : "Pie",
+ radius : 50,
+ labelOffset : 100,
+ fontColor : "black",
+ fontSize : 20
+ });
+
+ var ser = [ 2, 8, 12, 3 ];
+ c.addSeries("Series", ser);
+ c.setTheme(blue);
+ c.render();
+ c.theme.plotarea.fill = undefined;
+
+ var descr = {
+ longitude : ny.longitude,
+ latitude : ny.latitude,
+ widget : chart,
+ width : 120,
+ height : 120
+ };
+ feat3 = new WidgetFeature(descr);
+
+ // create a GfxLayer
+ var layer = new GfxLayer();
+
+ var point = new Point({
+ x:ny.longitude,
+ y:ny.latitude
+ });
+ // create a GeometryFeature
+ var feat = new GeometryFeature(point);
+ // set the shape properties, fill and stroke
+ feat.setFill([ 0, 128, 128 ]);
+ feat.setStroke([ 0, 0, 0 ]);
+ feat.setShapeProperties({
+ r : 8
+ });
+
+ var pts = new LineString(people);
+ // create a GeometryFeature
+ var feat2 = new GeometryFeature(pts);
+ // set the shape stroke property
+ feat2.setStroke([ 0, 0, 0 ]);
+
+ // add the feature to the layer
+ layer.addFeature(feat);
+ layer.addFeature(feat2);
+ layer.addFeature(feat3);
+ // add layer to the map
+ self.map.addLayer(layer);
+
+ // fit to New York with 0.1 degrees extent
+ self.map.fitTo({
+ position : [ ny.longitude, ny.latitude ],
+ extent : 0.001
+ });
+ });
+ });
+}
diff --git a/apps/samples/vrml.zip b/apps/samples/vrml.zip
new file mode 100644
index 0000000..730236b
--- /dev/null
+++ b/apps/samples/vrml.zip
Binary files differ
diff --git a/apps/samples/vrml/img/Tutorial.png b/apps/samples/vrml/img/Tutorial.png
new file mode 100644
index 0000000..7f5a041
--- /dev/null
+++ b/apps/samples/vrml/img/Tutorial.png
Binary files differ
diff --git a/apps/samples/vrml/img/Tutorial.pxm b/apps/samples/vrml/img/Tutorial.pxm
new file mode 100644
index 0000000..682a00c
--- /dev/null
+++ b/apps/samples/vrml/img/Tutorial.pxm
Binary files differ
diff --git a/apps/samples/vrml/img/drag.png b/apps/samples/vrml/img/drag.png
new file mode 100644
index 0000000..b398a3f
--- /dev/null
+++ b/apps/samples/vrml/img/drag.png
Binary files differ
diff --git a/apps/samples/vrml/img/drag2.png b/apps/samples/vrml/img/drag2.png
new file mode 100644
index 0000000..4dfb651
--- /dev/null
+++ b/apps/samples/vrml/img/drag2.png
Binary files differ
diff --git a/apps/samples/vrml/img/drag3.png b/apps/samples/vrml/img/drag3.png
new file mode 100644
index 0000000..467ba6e
--- /dev/null
+++ b/apps/samples/vrml/img/drag3.png
Binary files differ
diff --git a/apps/samples/vrml/img/pitchRoll.png b/apps/samples/vrml/img/pitchRoll.png
new file mode 100644
index 0000000..4f73745
--- /dev/null
+++ b/apps/samples/vrml/img/pitchRoll.png
Binary files differ
diff --git a/apps/samples/vrml/img/pitchRoll3.png b/apps/samples/vrml/img/pitchRoll3.png
new file mode 100644
index 0000000..ede9247
--- /dev/null
+++ b/apps/samples/vrml/img/pitchRoll3.png
Binary files differ
diff --git a/apps/samples/vrml/img/xy.png b/apps/samples/vrml/img/xy.png
new file mode 100644
index 0000000..fe081ee
--- /dev/null
+++ b/apps/samples/vrml/img/xy.png
Binary files differ
diff --git a/apps/samples/vrml/img/xy2.png b/apps/samples/vrml/img/xy2.png
new file mode 100644
index 0000000..2cc3f15
--- /dev/null
+++ b/apps/samples/vrml/img/xy2.png
Binary files differ
diff --git a/apps/samples/vrml/img/yawZoom.png b/apps/samples/vrml/img/yawZoom.png
new file mode 100644
index 0000000..a256b3b
--- /dev/null
+++ b/apps/samples/vrml/img/yawZoom.png
Binary files differ
diff --git a/apps/samples/vrml/viewer.html b/apps/samples/vrml/viewer.html
index 1e1043b..9838c33 100644
--- a/apps/samples/vrml/viewer.html
+++ b/apps/samples/vrml/viewer.html
@@ -38,16 +38,37 @@
<script type="text/javascript">
require(["dojo/domReady!", "dojo"], function(dom, dojo) {
- var viewer = new VRMLViewer("scene1");
- var annotations = new Annotations("annotations1", { 'viewer': viewer });
+ var viewer = new VRMLViewer("scene1", {
+ "pose": {
+ "pitch" : 0,
+ "roll" : 0,
+ "yaw" : 0,
+ "zoom" : 1,
+ "x" : 0,
+ "y" : 0,
+ "z" : 0,
+ "width" : 400,
+ "height" : 400,
+ "autorotate" : false
+ },
+ "serverURL": "http://smartvortex.tbm.tudelft.nl:8090/vrml",
+ "imageURL": "http://smartvortex.tbm.tudelft.nl:8090/vrml/hook/HARD_MP_VAL_005.png"
+ });
+ var viewer2 = new VRMLViewer("scene2");
+// var annotations = new Annotations("annotations1", { 'viewer': viewer });
});
</script>
</head>
<body class="tundra">
- <table>
- <tr><td>
- <div id="scene1" />
- </td></tr>
+ <table align="center">
+ <tr>
+ <td><br /><br /><br /><br /><br /><br />
+ <div id="scene1" />
+ </td>
+ <td><br /><br /><br /><br /><br /><br />
+ <div id="scene2" />
+ </td>
+ </tr>
<tr><td>
<div id="annotations1"></div>
</td></tr>
diff --git a/apps/samples/vrml/viewer.js b/apps/samples/vrml/viewer.js
index f6f2e42..660a66a 100644
--- a/apps/samples/vrml/viewer.js
+++ b/apps/samples/vrml/viewer.js
@@ -6,10 +6,13 @@ function VRMLViewer(element, params) {
// private instanceId
if (!VRMLViewer.instances)
VRMLViewer.instances = 0;
- var instanceId = VRMLViewer.instances++;
+ this.instanceId = VRMLViewer.instances++;
var batchChanges = false;
// public attributes
+ this.width = 450;
+ this.height = 350;
+
this.pose = {};
this.pose.pitch = 0;
this.pose.roll = 0;
@@ -18,49 +21,142 @@ function VRMLViewer(element, params) {
this.pose.x = 0;
this.pose.y = 0;
this.pose.z = 0;
- this.pose.width = 450;
- this.pose.height = 350;
this.pose.autorotate = false;
-
- this.serverURL = "http://88.69.49.213:8080/vrml";
+ this.serverURL;
this.imageURL;
+
+ this.pose.width = this.width;
+ this.pose.height = this.height;
+
+ this.params = params;
+
+ // privileged public methods
+ this.updateScene = function() {
+ if (self.imageURL && !self.batchChanges) {
+ self.imgElem.src = self.imageURL + urlSuffixForPose(self.pose);
+ }
+ }
+
+ var urlSuffixForPose = function(pose) {
+ var url =
+ '?width=' + pose.width +
+ '&height=' + pose.height +
+ '&pitch=' + pose.pitch +
+ '&roll=' + pose.roll +
+ '&yaw=' + pose.yaw +
+ '&x=' + pose.x +
+ '&y=' + pose.y +
+ '&z=' + pose.z +
+ '&zoom=' + pose.zoom +
+ '&autorotate=' + (pose.autorotate ? '1' : '0');
+ return url;
+ }
+
+ var moverRelativeTo = function(mover, container) {
+ var containerPos = absolutePosition(container);
+ return {
+ x: mover.x - containerPos.x,
+ y: mover.y - containerPos.y
+ };
+ }
+
+ // see http://stackoverflow.com/questions/288699/get-the-position-of-a-div-span-tag
+ var absolutePosition = function(el) {
+ for (var lx=0, ly=0; el != null; lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent);
+ return {x: lx,y: ly};
+ }
+
+ this.refreshServer = function(server) {
+ self.serverURL = server;
+ self.localStorage.put("vrmlServer", self.serverURL, null);
+ self.progressElem.appendChild(self.progress.domNode);
+ self.progress.start();
+ self.xhr.get({
+ // The URL to request
+ url: server,
+ handleAs:"json",
+ headers:{"X-Requested-With":null},
+ load: function(result) {
+ self.progress.stop();
+ for (id in self.fileStore.query) {
+ self.fileStore.remove(id);
+ }
+ (function fillstore(tree, parentId) {
+ for (key in tree) {
+ if ('url' in tree[key]) {
+ self.fileStore.add({id:parentId+key, name:key, url:self.serverURL + tree[key].path, parent:parentId});
+ } else {
+ self.fileStore.add({id:parentId+key, name:key, parent:parentId});
+ fillstore(tree[key], parentId+key);
+ }
+ }
+ } (result.models, "root", ""));
+ }
+ });
+ }
+
+ this.setPose = function(imageURL, pose, serverURL) {
+ if (serverURL && serverURL != self.serverURL) {
+ self.refreshServer(serverURL);
+ }
+ self.imageURL = imageURL;
+ self.pose = pose;
+
+ var pitch = (pose.pitch % (2 * 3.14159) + 0.5) * 100;
+ var roll = (pose.roll % (2 * 3.14159) + 0.5) * 100;
+ var yaw = (pose.yaw % (2 * 3.14159) + 0.5) * 100;
+
+ var x = ((pose.x / 100) + 0.5) * 100;
+ var y = ((pose.y / 100) + 0.5) * 100;
+
+ var zoom = (((pose.zoom - 1) / 3) + 0.5) * 100;
+
+ self.pitchRollHandlerElem.parentNode.style.right = pitch + "%";
+ self.pitchRollHandlerElem.parentNode.style.top = roll + "%";
+
+ self.yawZoomHandlerElem.parentNode.style.right = yaw + "%";
+ self.yawZoomHandlerElem.parentNode.style.top = zoom + "%";
+
+ self.xyHandlerElem.parentNode.style.right = x + "%";
+ self.xyHandlerElem.parentNode.style.top = y + "%";
+
+ self.updateScene();
+ }
require(["dojo/dom-construct",
"dojo/_base/xhr",
"dojo/dom",
+ "dojo/on",
"dojox/storage",
- "dojox/layout/FloatingPane",
"dojo/store/Memory",
"dojo/store/Observable",
"dijit/tree/ObjectStoreModel",
"dijit/Tree",
"dijit/form/TextBox",
"dijit/form/Button",
- "dijit/form/NumberSpinner",
- "dijit/form/VerticalSlider",
- "dijit/form/VerticalRuleLabels",
- "dijit/form/VerticalRule",
- "dijit/form/HorizontalSlider",
"dojox/mobile/ProgressIndicator",
- "dojo/ready"],
+ "dijit/form/DropDownButton",
+ "dijit/TooltipDialog",
+ "dojo/dnd/Moveable",
+ "dojo/ready",
+ "dojo/dnd/Source"],
function(domConst,
xhr,
dom,
+ on,
storage,
- FloatingPane,
Memory,
Observable,
ObjectStoreModel,
Tree,
TextBox,
Button,
- NumberSpinner,
- VerticalSlider,
- VerticalRuleLabels,
- VerticalRule,
- HorizontalSlider,
ProgressIndicator,
- ready) {
+ DropDownButton,
+ TooltipDialog,
+ Moveable,
+ ready,
+ Source) {
ready(function() {
@@ -78,41 +174,54 @@ function VRMLViewer(element, params) {
// establish our dom
element.appendChild(domConst.toDom('\
- <div class="floatPane">\
- <div style="text-align: right"><div class="server" /></div><button type="button" class="browseButton"></button></div>\
- <div style="height: 100%; overflow: auto" class="fileList"></div>\
- </div>\
<table>\
<tr>\
<td valign="top">\
<div style="position: relative; padding: 0px">\
- <img class="model" style="z-index: -1; min-width: ' + self.pose.width + 'px; min-height: ' + self.pose.height + 'px"></img>\
+ <img class="model" src="img/Tutorial.png" style="z-index: -1; width: ' + self.pose.width + 'px; height: ' + self.pose.height + 'px"></img>\
<div style="z-index: 1; position: absolute; right: 45%; top: 45%">\
<div class="progress"></div>\
</div>\
- <div style="position: absolute; left: 10px; top: 7%; height: 100%">\
- <div class="pitchSlide"></div>\
+ <div style="position: absolute; left: 10px; top: 10px">\
+ <table></tr>\
+ <td class="browseDropDown" style="vertical-align: middle"></td>\
+ <td align="right"><button type="button" class="resetButton"></button></td>\
+ <td class="dragHandler" style="vertical-align: middle; padding-top: 4px;"></td>\
+ </tr></table>\
</div>\
<div style="position: absolute; right: 10px; top: 15%; height: 50%">\
<div class="zoomSlide"></div>\
</div>\
- <div style="position: absolute; left: 7%; top: 10px; width: 100%">\
- <div class="rollSlide"></div>\
+ <div style="position: absolute; right: 55%; top: 48%">\
+ <div class="pitchRollHandler" style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px;">\
+ <table>\
+ <tr>\
+ <td><img class="pitchRollHandlerImg" src="img/pitchRoll.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\
+ <td><div class="pitchLabel"></div><div class="rollLabel"></div></td>\
+ </tr>\
+ </table>\
+ </div>\
</div>\
- <div style="position: absolute; left: 7%; bottom: 15px;">\
- <div class="yawSlide"></div>\
+ <div style="position: absolute; right: 45%; top: 48%">\
+ <div class="yawZoomHandler" style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px;">\
+ <table>\
+ <tr>\
+ <td><img class="yawZoomHandlerImg" src="img/yawZoom.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\
+ <td><div class="yawLabel"></div><div class="zoomLabel"></div></td>\
+ </tr>\
+ </table>\
+ </div>\
+ </div>\
+ <div style="position: absolute; right: 50%; top: 58%">\
+ <div class="xyHandler" style="font-size: 0.5em; background-color: rgba(255,255,255,0.5); border-radius: 5px; moz-border-radius: 5px;">\
+ <table>\
+ <tr>\
+ <td><img class="xyHandlerImg" src="img/xy.png" width="20px" style="padding: 2px 0px 0px 4px;" /></td>\
+ <td><div class="xLabel"></div><div class="yLabel"></div></td>\
+ </tr>\
+ </table>\
+ </div>\
</div>\
- <table cellspacing="0" style="position: absolute; right: 5px; bottom: 25px">\
- <tr>\
- <td align="right">x: <input type="text" class="xSpinner"></input></td>\
- </tr>\
- <tr>\
- <td align="right">y: <input type="text" class="ySpinner"></input></td>\
- </tr>\
- <tr>\
- <td align="right"><button type="button" class="resetButton"></button></td>\
- </tr>\
- </table>\
</div>\
</td>\
<td valign="top" height="100%">\
@@ -127,28 +236,127 @@ function VRMLViewer(element, params) {
// fetch special dom nodes for content
self.messageBox = dojo.query("div.messages", element)[0];
self.imgElem = dojo.query("img.model", element)[0];
- self.serverBoxElem = dojo.query("div.server", element)[0];
- self.browseButtonElem = dojo.query("button.browseButton", element)[0];
- self.fileListElem = dojo.query("div.fileList", element)[0];
+ self.browseDropDownElem = dojo.query("td.browseDropDown", element)[0];
self.resetButtonElem = dojo.query("button.resetButton", element)[0];
- self.xSpinnerElem = dojo.query("input.xSpinner", element)[0];
- self.ySpinnerElem = dojo.query("input.ySpinner", element)[0];
- self.pitchSlideElem = dojo.query("div.pitchSlide", element)[0];
- self.rollSlideElem = dojo.query("div.rollSlide", element)[0];
- self.yawSlideElem = dojo.query("div.yawSlide", element)[0];
- self.zoomSlideElem = dojo.query("div.zoomSlide", element)[0];
self.progressElem = dojo.query("div.progress", element)[0];
- self.floatPaneElem = dojo.query("div.floatPane", element)[0];
+ self.pitchRollHandlerElem = dojo.query(".pitchRollHandler", element)[0];
+ self.yawZoomHandlerElem = dojo.query(".yawZoomHandler", element)[0];
+ self.xyHandlerElem = dojo.query(".xyHandler", element)[0];
- self.floatPane = new FloatingPane({
- title: "VRML Viewer",
- resizable: true, dockable: false, closable: false,
- style: "position:absolute;top:10;left:10;width:250px;height:300px;z-index: 2",
- id: "floatPane",
- }, self.floatPaneElem);
- self.floatPane.startup();
+ self.pitchRollHandler = new Moveable(self.pitchRollHandlerElem);
+ self.pitchRollHandler.onMoveStop = function(mover) {
+ var handlerImg = dojo.query("img.pitchRollHandlerImg", mover.node)[0];
+ var pitchLabel = dojo.query("div.pitchLabel", mover.node)[0];
+ var rollLabel = dojo.query("div.rollLabel", mover.node)[0];
+
+ pitchLabel.innerHTML = '';
+ rollLabel.innerHTML = '';
+
+ self.updateScene();
+ }
+ self.pitchRollHandler.onMoving = function(mover) {
+ // mover.node.style.backgroundColor = "rgba(255,255,255,0.5)";
+ // mover.node.style.borderRadius = "5px";
+ // mover.node.style.mozBorderRadius = "5px";
+ // mover.node.style.webkitBorderRadius = "5px";
+ var handlerImg = dojo.query(".pitchRollHandlerImg", mover.node)[0];
+ var pitchLabel = dojo.query(".pitchLabel", mover.node)[0];
+ var rollLabel = dojo.query(".rollLabel", mover.node)[0];
+ var offset = moverRelativeTo(handlerImg, self.element);
+
+ // self.pose.pitch = self.pose.pitch % (2 * 3.14159);
+ // self.pose.roll = self.pose.roll % (2 * 3.14159);
+ self.pose.roll = offset.x / self.pose.width - 0.5;
+ self.pose.pitch = offset.y / self.pose.height - 0.5;
+ self.pose.roll *= 2 * 3.14159;
+ self.pose.pitch *= 2 * 3.14159;
+ self.pose.roll = Math.ceil((self.pose.roll) * 10) / 10;
+ self.pose.pitch = Math.ceil((self.pose.pitch) * 10) / 10;
+ pitchLabel.innerHTML = 'Pitch:' + self.pose.pitch;
+ rollLabel.innerHTML = 'Roll:' + self.pose.roll;
+ }
+
+ self.yawZoomHandler = new Moveable(self.yawZoomHandlerElem);
+ self.yawZoomHandler.onMoveStop = function(mover) {
+ var handlerImg = dojo.query("img.yawZoomHandlerImg", mover.node)[0];
+ var yawLabel = dojo.query("div.yawLabel", mover.node)[0];
+ var zoomLabel = dojo.query("div.zoomLabel", mover.node)[0];
+
+ yawLabel.innerHTML = '';
+ zoomLabel.innerHTML = '';
+
+ self.updateScene();
+ }
+ self.yawZoomHandler.onMoving = function(mover) {
+ var handlerImg = dojo.query("img.yawZoomHandlerImg", mover.node)[0];
+ var yawLabel = dojo.query("div.yawLabel", mover.node)[0];
+ var zoomLabel = dojo.query("div.zoomLabel", mover.node)[0];
+ var offset = moverRelativeTo(handlerImg, self.element);
+
+ // self.pose.pitch = self.pose.pitch % (2 * 3.14159);
+ // self.pose.roll = self.pose.roll % (2 * 3.14159);
+ self.pose.yaw = (self.pose.width - offset.x) / self.pose.width - 0.5;
+ self.pose.zoom = offset.y / self.pose.height - 0.5;
+ self.pose.yaw *= 2 * 3.14159;
+ self.pose.zoom = self.pose.zoom * 3 + 1;
+ self.pose.zoom = Math.ceil((self.pose.zoom) * 10) / 10;
+ self.pose.yaw = Math.ceil((self.pose.yaw) * 10) / 10;
+ yawLabel.innerHTML = 'Yaw:' + self.pose.yaw;
+ zoomLabel.innerHTML = 'Zoom:' + self.pose.zoom;
+ }
+ self.xyHandler = new Moveable(self.xyHandlerElem);
+ self.xyHandler.onMoveStop = function(mover) {
+ var handlerImg = dojo.query("img.xyHandlerImg", mover.node)[0];
+ var xLabel = dojo.query("div.xLabel", mover.node)[0];
+ var yLabel = dojo.query("div.yLabel", mover.node)[0];
+
+ xLabel.innerHTML = '';
+ yLabel.innerHTML = '';
+
+ self.updateScene();
+ }
+ self.xyHandler.onMoving = function(mover) {
+ var handlerImg = dojo.query("img.xyHandlerImg", mover.node)[0];
+ var xLabel = dojo.query("div.xLabel", mover.node)[0];
+ var yLabel = dojo.query("div.yLabel", mover.node)[0];
+ var offset = moverRelativeTo(handlerImg, self.element);
+
+ self.pose.x = offset.x / self.pose.width - 0.5;
+ self.pose.y = offset.y / self.pose.height - 0.5;
+ self.pose.x *= 100;
+ self.pose.y *= 100;
+ self.pose.y = Math.ceil((self.pose.y) * 10) / 10;
+ self.pose.x = Math.ceil((self.pose.x) * 10) / 10;
+ xLabel.innerHTML = 'X:' + self.pose.x;
+ yLabel.innerHTML = 'Y:' + self.pose.y;
+ }
+
+ self.createAvatar = function(item, mode) {
+ if (mode == 'avatar') {
+ // create your avatar if you want
+ var avatar = dojo.create( 'div', { innerHTML: item.data });
+ var avatarPose = dojo.clone(self.pose);
+ avatarPose.width=60;
+ avatarPose.height=60;
+ var avatarImgUrl = urlSuffixForPose(avatarPose);
+ avatar.innerHTML = '<img src=' + self.imageURL + avatarImgUrl + ' /> ';
+ item.srcEcc = "VRMLViewer";
+ item.iconPoseUrl = self.imageURL + avatarImgUrl;
+ item.imageURL = self.imageURL;
+ item.serverURL = self.serverURL;
+ item.pose = avatarPose;
+ return {node: avatar, data: item, type: item.type};
+ }
+ console.log(item, mode);
+ var handler = dojo.create( 'div', { innerHTML: '<img src="img/drag.png" width="20px" />' });
+ return {node: handler, data: item, type: item.type};
+ };
+
+ self.dragHandler = new Source(dojo.query("td.dragHandler", element)[0], {copyOnly: true, creator: self.createAvatar});
+ self.dragHandler.insertNodes(false, [ { } ]);
+
// setup fileStore for tree list
self.fileStore = new Observable(new Memory({
data: [ { id: 'root', name:'3D Models'} ],
@@ -163,12 +371,12 @@ function VRMLViewer(element, params) {
// setup actual tree dijit
self.fileList = new dijit.Tree({
- id: "fileList",
+ id: "fileList" + self.instanceId,
model: self.fileTreeModel,
persist: false,
showRoot: false,
+ style: "height: 200px;",
onClick: function(item){
- // self.messageBox.innerHTML = '<pre>' + item.url + '?width=200&height=150</pre>' + '<img src="' + item.url + '?width=200&height=150" />';
if ('url' in item) {
self.imageURL = item.url;
self.updateScene();
@@ -184,14 +392,8 @@ function VRMLViewer(element, params) {
}
//return {backgroundImage: "url('" + item.url + "?width=16&height=16')"};
- }).placeAt(self.fileListElem);
- //tree.dndController.singular = true;
-
- var savedServerURL = self.localStorage.get("vrmlServer");
- if (savedServerURL) {
- self.serverURL = savedServerURL;
- }
-
+ });
+
self.serverBox = new TextBox({
name: "Server",
value: self.serverURL,
@@ -205,221 +407,57 @@ function VRMLViewer(element, params) {
return false;
}
},
- }, self.serverBoxElem);
-
-
- self.resetButton = new Button({
- label: "Reset",
- onClick: function(){
- self.xSpinner.set('value',0);
- self.ySpinner.set('value',0);
- self.zSpinner.set('value',0);
- self.pitchSlide.attr('value',0);
- self.rollSlide.attr('value',0);
- self.yawSlide.attr('value',0);
- self.zoomSlide.attr('value',1);
-
- self.floatPane.domNode.style.top = "10px";
- self.floatPane.domNode.style.left = "10px";
-// self.floatPane.startup();
- self.floatPane.show();
- }
- }, self.resetButtonElem);
-
- self.xSpinner = new NumberSpinner({
- value: 0,
- smallDelta: 1,
- constraints: { places:0 },
- style: "width:60px",
- onChange: function(value){
- self.pose.x = value;
- self.updateScene();
- }
- }, self.xSpinnerElem );
-
- self.ySpinner = new NumberSpinner({
- value: 0,
- smallDelta: 1,
- constraints: { places:0 },
- style: "width:60px",
- onChange: function(value){
- self.pose.y = value;
- self.updateScene();
- }
- }, self.ySpinnerElem );
-
- self.zSpinner = new NumberSpinner({
- value: 0,
- smallDelta: 1,
- constraints: { places:0 },
- style: "width:60px",
- onChange: function(value){
- self.pose.z = value;
- self.updateScene();
- }
- }, self.zSpinnerElem );
+ });
self.browseButton = new Button({
label: "Browse",
onClick: function(){
self.refreshServer(self.serverBox.get("value"));
}
- }, self.browseButtonElem);
-
- // add zoom slider
- self.zoomSlide = new VerticalSlider({
- minimum: 0.001,
- showButtons: false,
- maximum: 1,
- value: 1,
- intermediateChanges: false,
- style: "height: 90%",
- onChange: function(value){
- self.pose.zoom = Math.ceil(value * 1000) / 1000;
- self.updateScene();
- }
- }, self.zoomSlideElem);
-
- // add pitch slider
- // Create the rules
- // var rulesNode = dojo.create("div", {}, self.pitchSlideElem, "first");
- // var sliderRules = new VerticalRule({
- // container: "leftDecoration",
- // count: 11,
- // style: "width: 5px;"}, rulesNode);
+ });
- // Create the labels
- // var labelsNode = dojo.create(
- // "div", {}, self.pitchSlideElem, "first");
- // var sliderLabels = new VerticalRuleLabels({
- // labels: ["Pitch", ""],
- // container: "rightDecoration",
- // labelStyle: "-webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); padding-left: -3px; font-size: 0.75em"
- // }, labelsNode);
+ self.browseDropDownContent = domConst.toDom('<div />');
+ self.browseDropDownContent.appendChild(self.serverBox.domNode);
+ self.browseDropDownContent.appendChild(self.browseButton.domNode);
+ self.browseDropDownContent.appendChild(self.fileList.domNode);
- self.pitchSlide = new VerticalSlider({
- minimum: 0,
- showButtons: false,
- maximum: 2 * 3.14159,
- value: 0,
- intermediateChanges: false,
- style: "height: 90%",
- onChange: function(value){
- self.pose.pitch = Math.ceil(value * 100) / 100;
- self.updateScene();
- }
- }, self.pitchSlideElem);
+ self.browseToolTip = new TooltipDialog({ content:self.browseDropDownContent, style:"max-height:200px"});
+ self.browseDropDown = new DropDownButton({ label: "Files", dropDown: self.browseToolTip });
+ self.browseDropDownElem.appendChild(self.browseDropDown.domNode);
- // add roll slider
- self.rollSlide = new HorizontalSlider({
- minimum: 0,
- showButtons: false,
- maximum: 2 * 3.14159,
- intermediateChanges: false,
- style: "width: 90%",
- onChange: function(value){
- self.pose.roll = Math.ceil(value * 100) / 100;
- self.updateScene();
- }
- }, self.rollSlideElem);
+ self.resetButton = new Button({
+ label: "Reset",
+ onClick: function(){
+ self.pose.x = 0;
+ self.pose.y = 0;
+ self.pose.pitch = 0;
+ self.pose.roll = 0;
+ self.pose.yaw = 0;
+ self.pose.zoom = 1;
+
+ self.xyHandler.node.style.left = 0;
+ self.xyHandler.node.style.top = 0;
+ self.pitchRollHandler.node.style.left = 0;
+ self.pitchRollHandler.node.style.top = 0;
+ self.yawZoomHandler.node.style.left = 0;
+ self.yawZoomHandler.node.style.top = 0;
- // add yaw slider
- self.yawSlide = new HorizontalSlider({
- minimum: 0,
- showButtons: false,
- maximum: 2 * 3.14159,
- intermediateChanges: false,
- style: "width: 90%",
- onChange: function(value){
- self.pose.yaw = Math.ceil(value * 100) / 100;
self.updateScene();
}
- }, self.yawSlideElem);
-
- })
- });
+ }, self.resetButtonElem);
- // privileged public methods
- this.updateScene = function() {
- if (self.imageURL && !self.batchChanges) {
- self.imgElem.src = self.imageURL +
- '?width=' + self.pose.width +
- '&height=' + self.pose.height +
- '&pitch=' + self.pose.pitch +
- '&roll=' + self.pose.roll +
- '&yaw=' + self.pose.yaw +
- '&x=' + self.pose.x +
- '&y=' + self.pose.y +
- '&z=' + self.pose.z +
- '&zoom=' + self.pose.zoom +
- '&autorotate=' + (self.pose.autorotate ? '1' : '0');
- }
- }
+ // do we have parameters for the initial pose?
+ if(self.params)
+ self.setPose(self.params.imageURL, self.params.pose, self.params.serverURL);
- this.refreshServer = function(server) {
- self.serverURL = server;
- self.localStorage.put("vrmlServer", self.serverURL, null);
- self.progressElem.appendChild(self.progress.domNode);
- self.progress.start();
- self.xhr.get({
- // The URL to request
- url: server,
- handleAs:"json",
- headers:{"X-Requested-With":null},
- load: function(result) {
- self.progress.stop();
- for (id in self.fileStore.query) {
- self.fileStore.remove(id);
+ var savedServerURL = self.localStorage.get("vrmlServer");
+ if (savedServerURL && !self.serverURL) {
+ self.serverURL = savedServerURL;
+ self.refreshServer(savedServerURL);
}
- (function fillstore(tree, parentId) {
- for (key in tree) {
- if ('url' in tree[key]) {
- self.fileStore.add({id:parentId+key, name:key, url:self.serverURL + tree[key].path, parent:parentId});
-// self.messageBox.innerHTML += '<pre>' + self.serverURL + tree[key].path + '</pre>';
-// self.messageBox.innerHTML += '<pre>' + tree[key].url + '?width=200&height=150</pre>' + '<img src="' + tree[key].url + '?width=200&height=150" />';
- } else {
- self.fileStore.add({id:parentId+key, name:key, parent:parentId});
- fillstore(tree[key], parentId+key);
- }
- }
- } (result.models, "root", ""));
- }
- });
- }
- this.setPose = function(imageURL, pose, serverURL) {
- if (serverURL && serverURL != self.serverURL) {
- refreshServer(serverURL);
- }
- self.imageURL = imageURL;
- self.pose = pose;
-
- self.batchChanges = true;
-// self.fileList.set('item', imageURL);
- self.xSpinner.set('value',pose.x);
- self.ySpinner.set('value',pose.y);
- self.zSpinner.set('value',pose.z);
- self.pitchSlide.attr('value',pose.pitch);
- self.rollSlide.attr('value',pose.roll);
- self.yawSlide.attr('value',pose.yaw);
- self.zoomSlide.attr('value',pose.zoom);
- self.batchChanges = false;
- updateScene();
- }
+ })
+ });
-/*
- view = "normal";
- // if (params.view == "maximized") {
- // view = "maximized";
- // }
-
- // if (this.view == "maximized") {
- // this.width = Math.min(element.clientWidth - 150, 800);
- // this.height = (this.width * 3) / 4;
- // } else {
- // this.width = Math.min(element.clientWidth - 50, 800);
- // this.height = (this.width * 3) / 4;
- // }
-*/
}
diff --git a/apps/mmi-browser.cpp b/apps/uscxml-browser.cpp
index a6db6ec..afe4e7f 100644
--- a/apps/mmi-browser.cpp
+++ b/apps/uscxml-browser.cpp
@@ -105,16 +105,17 @@ void customTerminate() {
}
void printUsageAndExit() {
- printf("mmi-browser version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n");
+ printf("uscxml-browser version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n");
printf("Usage\n");
- printf("\tmmi-browser");
+ printf("\tuscxml-browser");
#ifdef BUILD_AS_PLUGINS
- printf(" [-p pluginPath]");
+ printf(" [-d pluginPath]");
#endif
printf(" URL\n");
printf("\n");
printf("Options\n");
printf("\t-v : be verbose\n");
+ printf("\t-pN : port for HTTP server\n");
printf("\n");
exit(1);
}
@@ -133,6 +134,7 @@ int main(int argc, char** argv) {
}
bool verbose = false;
+ size_t port = 8080;
google::InitGoogleLogging(argv[0]);
google::LogToStderr();
@@ -140,14 +142,17 @@ int main(int argc, char** argv) {
opterr = 0;
#endif
int option;
- while ((option = getopt(argc, argv, "vl:p:")) != -1) {
+ while ((option = getopt(argc, argv, "vl:d:p:")) != -1) {
switch(option) {
case 'l':
google::InitGoogleLogging(optarg);
break;
- case 'p':
+ case 'd':
uscxml::Factory::pluginPath = optarg;
break;
+ case 'p':
+ port = strTo<size_t>(optarg);
+ break;
case 'v':
verbose = true;
break;
@@ -163,6 +168,9 @@ int main(int argc, char** argv) {
// std::cout << argv[i] << std::endl;
// std::cout << optind << std::endl;
+ // intialize http server on given port
+ HTTPServer::getInstance(port);
+
LOG(INFO) << "Processing " << argv[optind];
Interpreter interpreter = Interpreter::fromURI(argv[optind]);
if (interpreter) {
diff --git a/apps/mmi-browser.vbs b/apps/uscxml-browser.vbs
index fc8ea9a..fc8ea9a 100644
--- a/apps/mmi-browser.vbs
+++ b/apps/uscxml-browser.vbs
diff --git a/apps/w3c-mmi/MMIEventServlet.cpp b/apps/w3c-mmi/MMIEventServlet.cpp
new file mode 100644
index 0000000..5ee1807
--- /dev/null
+++ b/apps/w3c-mmi/MMIEventServlet.cpp
@@ -0,0 +1,210 @@
+#include "MMIEventServlet.h"
+#include <uscxml/NameSpacingParser.h>
+
+#ifdef _WIN32
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
+#include "uscxml/Message.h"
+#include <iostream>
+#include <event2/dns.h>
+#include <event2/buffer.h>
+#include <event2/keyvalq_struct.h>
+
+#include <string.h>
+
+#include <io/uri.hpp>
+#include <glog/logging.h>
+
+#ifndef _WIN32
+#include <netdb.h>
+#include <arpa/inet.h>
+#endif
+
+#define MMI_HTTP_EVENT_CASE(type) \
+else if (boost::iequals(mmiEvent.getLocalName(), #type)) { \
+ monIter = _monitors.begin(); \
+ while(monIter != _monitors.end()) { \
+ (*monIter)->received(type::fromXML(mmiDoc)); \
+ monIter++; \
+ } \
+}
+
+namespace uscxml {
+
+ using namespace Arabica::DOM;
+
+ MMIEventServlet::MMIEventServlet(const std::string& path) : _path(path) {
+ // register at http server
+ bool success = HTTPServer::registerServlet(_path, this);
+ assert(success);
+ }
+
+ MMIEventServlet::~MMIEventServlet() {
+ HTTPServer* httpServer = HTTPServer::getInstance();
+ httpServer->unregisterServlet(this);
+ }
+
+ void MMIEventServlet::send(const MMIEvent& mmiEvent) {
+ URL url(mmiEvent.target);
+ url.addMonitor(this);
+
+ std::stringstream content;
+ content << mmiEvent.toXML();
+ url.setOutContent(content.str());
+ url.download();
+
+ }
+
+ void MMIEventServlet::httpRecvRequest(const HTTPServer::Request& req) {
+
+ // is this a request from a HTML browser?
+
+
+ NameSpacingParser* parser = NameSpacingParser::fromXML(req.data.compound.at("content").atom);
+ if (!parser) {
+ evhttp_send_error(req.curlReq, 402, NULL);
+ return;
+ }
+
+ Document<std::string> mmiDoc = parser->getDocument();
+ std::cout << mmiDoc.getNamespaceURI() << std::endl;
+ Node<std::string> mmiEvent = mmiDoc.getFirstChild();
+ // get the first element
+ while (mmiEvent && mmiEvent.getNodeType() != Node_base::ELEMENT_NODE) {
+ mmiEvent = mmiEvent.getNextSibling();
+ }
+ // get the contained message
+ if (boost::iequals(mmiEvent.getLocalName(), "mmi")) {
+ mmiEvent = mmiEvent.getFirstChild();
+ while (mmiEvent && mmiEvent.getNodeType() != Node_base::ELEMENT_NODE) {
+ mmiEvent = mmiEvent.getNextSibling();
+ }
+ }
+ std::cout << mmiEvent << std::endl;
+
+ if (!mmiEvent) {
+ evhttp_send_error(req.curlReq, 402, NULL);
+ return;
+ }
+
+ std::set<MMIEventReceiver*>::iterator monIter;
+ if (false) {}
+ MMI_HTTP_EVENT_CASE(NewContextRequest)
+ MMI_HTTP_EVENT_CASE(NewContextResponse)
+ MMI_HTTP_EVENT_CASE(PrepareRequest)
+ MMI_HTTP_EVENT_CASE(PrepareResponse)
+ MMI_HTTP_EVENT_CASE(StartRequest)
+ MMI_HTTP_EVENT_CASE(StartResponse)
+ MMI_HTTP_EVENT_CASE(DoneNotification)
+ MMI_HTTP_EVENT_CASE(CancelRequest)
+ MMI_HTTP_EVENT_CASE(CancelResponse)
+ MMI_HTTP_EVENT_CASE(PauseRequest)
+ MMI_HTTP_EVENT_CASE(PauseResponse)
+ MMI_HTTP_EVENT_CASE(ResumeRequest)
+ MMI_HTTP_EVENT_CASE(ResumeResponse)
+ MMI_HTTP_EVENT_CASE(ExtensionNotification)
+ MMI_HTTP_EVENT_CASE(ClearContextRequest)
+ MMI_HTTP_EVENT_CASE(ClearContextResponse)
+ MMI_HTTP_EVENT_CASE(StatusRequest)
+ MMI_HTTP_EVENT_CASE(StatusResponse)
+ else {
+ LOG(ERROR) << "Unknown MMI Event";
+ evhttp_send_error(req.curlReq, 402, NULL);
+ return;
+ }
+
+ evhttp_send_reply(req.curlReq, 204, NULL, NULL);
+
+#if 0
+ Event reqEvent = req;
+ reqEvent.type = Event::EXTERNAL;
+ bool scxmlStructFound = false;
+
+ if (reqEvent.data.compound["header"].compound.find("Content-Type") != reqEvent.data.compound["header"].compound.end() &&
+ boost::iequals(reqEvent.data.compound["header"].compound["Content-Type"].atom, "application/x-www-form-urlencoded")) {
+ std::stringstream ss(reqEvent.data.compound["content"].atom);
+ std::string term;
+ while(std::getline(ss, term, '&')) {
+ size_t split = term.find_first_of("=");
+ if (split != std::string::npos) {
+ std::string key = evhttp_decode_uri(term.substr(0, split).c_str());
+ std::string value = evhttp_decode_uri(term.substr(split + 1).c_str());
+ if (boost::iequals(key, "_scxmleventname")) {
+ reqEvent.name = value;
+ } else if (boost::iequals(key, "content")) {
+ reqEvent.initContent(value);
+ } else {
+ reqEvent.data.compound[key] = value;
+ reqEvent.params.insert(std::make_pair(key, value));
+ }
+ } else {
+ // this is most likely wrong
+ reqEvent.content = evhttp_decode_uri(term.c_str());
+ }
+ }
+ } else {
+ if (reqEvent.data.compound["header"].compound.find("_scxmleventstruct") != reqEvent.data.compound["header"].compound.end()) {
+ // TODO: this looses all other information
+ reqEvent = Event::fromXML(evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventstruct"].atom.c_str()));
+ scxmlStructFound = true;
+ }
+ if (reqEvent.data.compound["header"].compound.find("_scxmleventname") != reqEvent.data.compound["header"].compound.end()) {
+ reqEvent.name = evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventname"].atom.c_str());
+ }
+ }
+ std::map<std::string, Data>::iterator headerIter = reqEvent.data.compound["header"].compound.begin();
+ while(headerIter != reqEvent.data.compound["header"].compound.end()) {
+ reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.atom.c_str()), Data::VERBATIM);
+ headerIter++;
+ }
+
+
+ /// test532
+ if (reqEvent.name.length() == 0)
+ reqEvent.name = "http." + req.data.compound.at("type").atom;
+
+ if (!scxmlStructFound) {
+ // get content into event
+ reqEvent.data.compound["content"] = Data(req.content, Data::VERBATIM);
+ }
+
+ evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+#endif
+ }
+
+ void MMIEventServlet::downloadStarted(const URL& url) {}
+
+ void MMIEventServlet::downloadCompleted(const URL& url) {
+ std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin();
+ while(reqIter != _sendRequests.end()) {
+ if (reqIter->second.first == url) {
+ _sendRequests.erase(reqIter);
+ return;
+ }
+ reqIter++;
+ }
+ assert(false);
+ }
+
+ void MMIEventServlet::downloadFailed(const URL& url, int errorCode) {
+
+ std::map<std::string, std::pair<URL, SendRequest> >::iterator reqIter = _sendRequests.begin();
+ while(reqIter != _sendRequests.end()) {
+ if (reqIter->second.first == url) {
+ Event failEvent;
+ failEvent.name = "error.communication";
+// returnEvent(failEvent);
+
+ _sendRequests.erase(reqIter);
+ return;
+ }
+ reqIter++;
+ }
+ assert(false);
+
+ }
+
+
+} \ No newline at end of file
diff --git a/apps/w3c-mmi/MMIEventServlet.h b/apps/w3c-mmi/MMIEventServlet.h
new file mode 100644
index 0000000..10adbc3
--- /dev/null
+++ b/apps/w3c-mmi/MMIEventServlet.h
@@ -0,0 +1,59 @@
+#ifndef MMIEVENTSERVLET_H_92WSR1SU
+#define MMIEVENTSERVLET_H_92WSR1SU
+
+
+#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h"
+#include "uscxml/server/HTTPServer.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+#ifndef _WIN32
+#include <sys/time.h>
+#endif
+
+#include <event2/http.h>
+#include <event2/http_struct.h>
+
+#include <uscxml/plugins/ioprocessor/modality/MMIMessages.h>
+
+namespace uscxml {
+
+ class MMIEventServlet : public HTTPServlet, public URLMonitor, public MMIEventSender {
+ public:
+ MMIEventServlet(const std::string& path);
+ virtual ~MMIEventServlet();
+
+ void addMonitor(MMIEventReceiver* mmiMonitor) {
+ _monitors.insert(mmiMonitor);
+ }
+ void removeMonitor(MMIEventReceiver* mmiMonitor) {
+ _monitors.erase(mmiMonitor);
+ }
+
+ /// HTTPServlet
+ void httpRecvRequest(const HTTPServer::Request& req);
+ void setURL(const std::string& url) {
+ _url = url;
+ }
+ std::string getURL() { return _url; }
+
+ bool canAdaptPath() {
+ return false;
+ }
+
+ // URLMonitor
+ void downloadStarted(const URL& url);
+ void downloadCompleted(const URL& url);
+ void downloadFailed(const URL& url, int errorCode);
+
+ // MMIEventSender
+ virtual void send(const MMIEvent& mmiEvent);
+
+ protected:
+ std::string _url;
+ std::string _path;
+ std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
+ std::set<MMIEventReceiver*> _monitors;
+ };
+}
+
+#endif /* end of include guard: MMIEVENTSERVLET_H_92WSR1SU */
diff --git a/apps/w3c-mmi/im/MMISessionManager.cpp b/apps/w3c-mmi/im/MMISessionManager.cpp
new file mode 100644
index 0000000..768a8a1
--- /dev/null
+++ b/apps/w3c-mmi/im/MMISessionManager.cpp
@@ -0,0 +1,257 @@
+#include "MMISessionManager.h"
+#include <uscxml/NameSpacingParser.h>
+#include <uscxml/concurrency/tinythread.h>
+
+#include <io/uri.hpp>
+#include <glog/logging.h>
+
+namespace uscxml {
+
+ using namespace Arabica::DOM;
+
+ MMISessionManager::MMISessionManager(Interpreter interpreter) : _protoInterpreter(interpreter) {
+ bool success = HTTPServer::registerServlet(interpreter.getName(), this);
+ assert(success);
+ _factory = new Factory(Factory::getInstance());
+ _factory->registerIOProcessor(new MMIIOProcessor(this));
+ }
+
+ MMISessionManager::~MMISessionManager() {
+ HTTPServer* httpServer = HTTPServer::getInstance();
+ httpServer->unregisterServlet(this);
+ }
+
+ void MMISessionManager::setupHTMLClient(const HTTPServer::Request& req) {
+ // open template file
+ HTTPServer::Reply reply(req);
+ URL templateURL(_protoInterpreter.getBaseURI().asString() + "/templates/mc-html.html");
+ templateURL.download(true);
+ std::string templateContent = templateURL.getInContent();
+ boost::replace_all(templateContent, "${im.url}", _url);
+ reply.content = templateContent;
+ HTTPServer::reply(reply);
+ }
+
+ void MMISessionManager::httpRecvRequest(const HTTPServer::Request& req) {
+ // is this an initial request from an HTML MC?
+ if (!req.data["query"]["token"] && // no token in query
+ boost::iequals(req.data["type"].atom, "get") && // request type is GET
+ boost::icontains(req.data["header"]["Accept"].atom, "text/html") && // accepts html
+ req.content.length() == 0) { // no content
+ setupHTMLClient(req);
+ return;
+ }
+
+ // is this a comet longpolling request?
+ if (req.data["query"]["token"] &&
+ boost::iequals(req.data["type"].atom, "get")) {
+ std::string token = req.data["query"]["token"].atom;
+ if (_tokens.find(token) != _tokens.end()) {
+ MMISessionManager::CometMMISession* comet = static_cast<MMISessionManager::CometMMISession*>(_tokens[token]);
+ comet->longPoll(req);
+ return;
+ }
+ }
+
+ // assume that there is an mmi event inside
+ NameSpacingParser* parser = NameSpacingParser::fromXML(req.data.compound.at("content").atom);
+ if (!parser) {
+ evhttp_send_error(req.curlReq, 204, NULL);
+ return;
+ }
+
+ Node<std::string> mmiEvent = MMIEvent::getEventNode(parser->getDocument());
+ if (!mmiEvent) {
+ evhttp_send_error(req.curlReq, 204, NULL);
+ return;
+ }
+
+ switch(MMIEvent::getType(mmiEvent)) {
+ case MMIEvent::NEWCONTEXTREQUEST: {
+ received(NewContextRequest::fromXML(mmiEvent), req.data["query"]["token"].atom);
+ evhttp_send_error(req.curlReq, 204, NULL);
+ break;
+ }
+ case MMIEvent::EXTENSIONNOTIFICATION: {
+ received(ExtensionNotification::fromXML(mmiEvent));
+ evhttp_send_error(req.curlReq, 204, NULL);
+ break;
+ }
+ default: {
+ LOG(ERROR) << "Unknown MMI Event";
+ evhttp_send_error(req.curlReq, 204, NULL);
+ break;
+ }
+ }
+ }
+
+ void MMISessionManager::received(const ExtensionNotification& mmiEvent) {
+ assert(_sessions.find(mmiEvent.context) != _sessions.end());
+ _sessions[mmiEvent.context]->_interpreter.receive(mmiEvent);
+ }
+
+ void MMISessionManager::received(const NewContextRequest& mmiEvent, const std::string& token) {
+
+ // copy DOM from prototype instance
+ Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
+ Arabica::DOM::Document<std::string> newDOM = domFactory.createDocument("", "", 0);
+ newDOM.appendChild(newDOM.importNode(_protoInterpreter.getDocument().getDocumentElement(), true));
+
+ // instantiate new interpreter and name it after the context
+ std::string contextId = Interpreter::getUUID();
+ Interpreter interpreter = Interpreter::fromDOM(newDOM);
+ interpreter.setFactory(_factory);
+ interpreter.setName(contextId);
+ interpreter.setNameSpaceInfo(_protoInterpreter.getNameSpaceInfo());
+ interpreter.setBaseURI(_protoInterpreter.getBaseURI().asString());
+
+ MMISession* session;
+
+ if (token.length() > 0) {
+ session = new MMISessionManager::CometMMISession();
+ static_cast<MMISessionManager::CometMMISession*>(session)->_token = token;
+ _tokens[token] = session;
+ } else {
+ // todo handle other cases
+ session = new MMISessionManager::CometMMISession();
+ }
+ session->_interpreter = interpreter;
+
+ // save interpreter
+ _sessions[contextId] = session;
+
+ interpreter.start();
+ interpreter.receive(mmiEvent);
+
+ }
+
+ void MMISessionManager::received(const NewContextResponse& mmiEvent) {
+ }
+
+ void MMISessionManager::send(const std::string& name, const SendRequest& req) {
+ assert(_sessions.find(name) != _sessions.end());
+ _sessions[name]->send(req);
+ }
+
+ void MMISessionManager::CometMMISession::send(const SendRequest& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (!_longPollingReq) {
+ _outQueue.push_back(req);
+ return;
+ }
+
+ if (req.dom) {
+ std::stringstream ss;
+ Node<std::string> mmiEvent = MMIEvent::getEventNode(req.dom);
+ HTTPServer::Reply reply(_longPollingReq);
+
+ switch (MMIEvent::getType(mmiEvent)) {
+ case MMIEvent::NEWCONTEXTRESPONSE: {
+ NewContextResponse response = NewContextResponse::fromXML(mmiEvent);
+ ss << response.toXML();
+ reply.content = ss.str();
+ break;
+ }
+ case MMIEvent::STARTREQUEST: {
+ StartRequest request = StartRequest::fromXML(mmiEvent);
+ std::cout << mmiEvent << std::endl;
+ ss << request.toXML();
+ reply.content = ss.str();
+ break;
+ }
+ default:
+ break;
+ }
+ reply.headers["Content-Type"] = "application/xml";
+ HTTPServer::reply(reply);
+ _longPollingReq = HTTPServer::Request();
+ }
+ }
+
+ void MMISessionManager::CometMMISession::receive(const Arabica::DOM::Node<std::string>& msg) {
+
+ }
+
+ void MMISessionManager::CometMMISession::longPoll(const HTTPServer::Request& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (_longPollingReq)
+ evhttp_send_error(_longPollingReq.curlReq, 204, NULL);
+ _longPollingReq = req;
+ if (!_outQueue.empty()) {
+ send(_outQueue.front());
+ _outQueue.pop_front();
+ }
+ }
+
+ boost::shared_ptr<IOProcessorImpl> MMISessionManager::MMIIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<IOProcessorImpl> ioProc = boost::shared_ptr<IOProcessorImpl>(new MMISessionManager::MMIIOProcessor(_sessionManager));
+ return ioProc;
+ }
+
+ Data MMISessionManager::MMIIOProcessor::getDataModelVariables() {
+ Data data;
+ return data;
+ }
+
+ void MMISessionManager::MMIIOProcessor::send(const SendRequest& req) {
+ SendRequest reqCopy(req);
+
+ if (req.dom) {
+ Arabica::DOM::Node<std::string> mmiEvent = MMIEvent::getEventNode(req.dom);
+ if (!mmiEvent || !mmiEvent.getNodeType() == Node_base::ELEMENT_NODE)
+ return;
+
+ Arabica::DOM::Element<std::string> mmiElem = Arabica::DOM::Element<std::string>(mmiEvent);
+ switch (MMIEvent::getType(mmiEvent)) {
+ case MMIEvent::STARTRESPONSE:
+ case MMIEvent::PREPARERESPONSE:
+ case MMIEvent::PAUSERESPONSE:
+ case MMIEvent::RESUMERESPONSE:
+ case MMIEvent::CANCELRESPONSE:
+ case MMIEvent::DONENOTIFICATION:
+ case MMIEvent::NEWCONTEXTRESPONSE:
+ case MMIEvent::CLEARCONTEXTRESPONSE:
+ case MMIEvent::STATUSRESPONSE: {
+ // all of the above have a status
+ if (!mmiElem.hasAttributeNS(MMIEvent::nameSpace, "Status")) {
+ mmiElem.setAttributeNS(MMIEvent::nameSpace, "Status", "Success");
+ }
+ }
+ case MMIEvent::PAUSEREQUEST:
+ case MMIEvent::RESUMEREQUEST:
+ case MMIEvent::CANCELREQUEST:
+ case MMIEvent::CLEARCONTEXTREQUEST:
+ case MMIEvent::STATUSREQUEST: {
+ // all of the above have a context
+ if (!mmiElem.hasAttributeNS(MMIEvent::nameSpace, "Context")) {
+ mmiElem.setAttributeNS(MMIEvent::nameSpace, "Context", _interpreter->getName());
+ }
+ }
+ default: {
+ if (!mmiElem.hasAttributeNS(MMIEvent::nameSpace, "Source")) {
+ mmiElem.setAttributeNS(MMIEvent::nameSpace, "Source", _sessionManager->getURL());
+ }
+ if (!mmiElem.hasAttributeNS(MMIEvent::nameSpace, "Target")) {
+ if (boost::starts_with(_interpreter->getCurrentEvent().name, "mmi.")) {
+ mmiElem.setAttributeNS(MMIEvent::nameSpace, "Target", _interpreter->getCurrentEvent().origin);
+ }
+ }
+ if (!mmiElem.hasAttributeNS(MMIEvent::nameSpace, "RequestID")) {
+ if (boost::starts_with(_interpreter->getCurrentEvent().name, "mmi.")) {
+ mmiElem.setAttributeNS(MMIEvent::nameSpace, "RequestID", _interpreter->getCurrentEvent().sendid);
+ }
+ }
+ }
+ }
+
+ if (MMIEvent::getType(mmiEvent) == MMIEvent::EXTENSIONNOTIFICATION && !mmiElem.hasAttribute("Name") && req.name.length() > 0) {
+ mmiElem.setAttribute("Name", req.name);
+ }
+ // use session mgr to dispatch to session
+
+ _sessionManager->send(_interpreter->getName(), reqCopy);
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/apps/w3c-mmi/im/MMISessionManager.h b/apps/w3c-mmi/im/MMISessionManager.h
new file mode 100644
index 0000000..2ca3d0c
--- /dev/null
+++ b/apps/w3c-mmi/im/MMISessionManager.h
@@ -0,0 +1,81 @@
+#ifndef MMISESSIONMANAGER_H_IHDWUAKD
+#define MMISESSIONMANAGER_H_IHDWUAKD
+
+#include <uscxml/Interpreter.h>
+#include <deque>
+#include "../MMIEventServlet.h"
+
+namespace uscxml {
+ class MMISessionManager : public HTTPServlet {
+ public:
+ MMISessionManager(Interpreter interpreter);
+ ~MMISessionManager();
+
+ class MMISession {
+ public:
+ Interpreter _interpreter;
+ tthread::recursive_mutex _mutex;
+ virtual void send(const SendRequest& req) = 0;
+ virtual void receive(const Arabica::DOM::Node<std::string>& msg) = 0;
+ };
+
+ class CometMMISession : public MMISession {
+ public:
+ HTTPServer::Request _request;
+ std::deque<SendRequest> _outQueue;
+ HTTPServer::Request _longPollingReq;
+ std::string _token;
+
+ void send(const SendRequest& req);
+ void receive(const Arabica::DOM::Node<std::string>& msg);
+ void longPoll(const HTTPServer::Request& req);
+ };
+
+ class MMIIOProcessor : public IOProcessorImpl {
+ public:
+ MMIIOProcessor(MMISessionManager* sessionManager) : _sessionManager(sessionManager) {}
+
+ // IOProcessorImpl
+ virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("mmi.event");
+ return names;
+ }
+ virtual Data getDataModelVariables();
+ virtual void send(const SendRequest& req);
+ protected:
+ MMISessionManager* _sessionManager;
+ };
+
+ void send(const std::string& name, const SendRequest& req);
+
+ /// HTTPServlet
+ void httpRecvRequest(const HTTPServer::Request& req);
+ void setURL(const std::string& url) {
+ _url = url;
+ }
+ std::string getURL() { return _url; }
+
+ bool canAdaptPath() {
+ return false;
+ }
+
+ protected:
+ void received(const NewContextRequest& mmiEvent, const std::string& token = "");
+ void received(const NewContextResponse& mmiEvent);
+ void received(const ExtensionNotification& mmiEvent);
+
+ void setupHTMLClient(const HTTPServer::Request& req);
+
+ Interpreter _protoInterpreter;
+ Factory* _factory;
+ DelayedEventQueue _eventQueue;
+ std::map<std::string, MMISession*> _sessions;
+ std::map<std::string, MMISession*> _tokens;
+ std::string _url;
+ };
+}
+
+
+#endif /* end of include guard: MMISESSIONMANAGER_H_IHDWUAKD */
diff --git a/apps/w3c-mmi/im/uscxml-interaction-manager.cpp b/apps/w3c-mmi/im/uscxml-interaction-manager.cpp
new file mode 100644
index 0000000..a7162cc
--- /dev/null
+++ b/apps/w3c-mmi/im/uscxml-interaction-manager.cpp
@@ -0,0 +1,182 @@
+#include "uscxml/config.h"
+#include "uscxml/Interpreter.h"
+#include <glog/logging.h>
+#include "uscxml/concurrency/tinythread.h"
+
+#include "MMISessionManager.h"
+
+#ifdef HAS_SIGNAL_H
+#include <signal.h>
+#endif
+
+#ifdef HAS_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+#ifdef HAS_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#ifdef _WIN32
+#include "XGetopt.h"
+#endif
+
+class VerboseMonitor : public uscxml::InterpreterMonitor {
+ void onStableConfiguration(uscxml::Interpreter interpreter) {
+ printConfig(interpreter.getConfiguration());
+ }
+
+ void beforeCompletion(uscxml::Interpreter interpreter) {
+ printConfig(interpreter.getConfiguration());
+ }
+
+ void printConfig(const Arabica::XPath::NodeSet<std::string>& config) {
+ std::string seperator;
+ std::cout << "Config: {";
+ for (int i = 0; i < config.size(); i++) {
+ std::cout << seperator << ATTR(config[i], "id");
+ seperator = ", ";
+ }
+ std::cout << "}" << std::endl;
+ }
+};
+
+
+#ifdef HAS_EXECINFO_H
+void printBacktrace(void** array, int size) {
+ char** messages = backtrace_symbols(array, size);
+ for (int i = 0; i < size && messages != NULL; ++i) {
+ std::cerr << "\t" << messages[i] << std::endl;
+ }
+ std::cerr << std::endl;
+ free(messages);
+}
+
+#ifdef HAS_DLFCN_H
+// see https://gist.github.com/nkuln/2020860
+typedef void (*cxa_throw_type)(void *, void *, void (*) (void *));
+cxa_throw_type orig_cxa_throw = 0;
+
+void load_orig_throw_code() {
+ orig_cxa_throw = (cxa_throw_type) dlsym(RTLD_NEXT, "__cxa_throw");
+}
+
+extern "C"
+void __cxa_throw (void *thrown_exception, void *pvtinfo, void (*dest)(void *)) {
+ std::cerr << __FUNCTION__ << " will throw exception from " << std::endl;
+ if (orig_cxa_throw == 0)
+ load_orig_throw_code();
+
+ void *array[50];
+ size_t size = backtrace(array, 50);
+ printBacktrace(array, size);
+ orig_cxa_throw(thrown_exception, pvtinfo, dest);
+}
+#endif
+#endif
+
+
+// see http://stackoverflow.com/questions/2443135/how-do-i-find-where-an-exception-was-thrown-in-c
+void customTerminate() {
+ static bool tried_throw = false;
+ try {
+ // try once to re-throw currently active exception
+ if (!tried_throw) {
+ throw;
+ tried_throw = true;
+ } else {
+ tried_throw = false;
+ };
+ } catch (const std::exception &e) {
+ std::cerr << __FUNCTION__ << " caught unhandled exception. what(): "
+ << e.what() << std::endl;
+ } catch (const uscxml::Event &e) {
+ std::cerr << __FUNCTION__ << " caught unhandled exception. Event: "
+ << e << std::endl;
+ } catch (...) {
+ std::cerr << __FUNCTION__ << " caught unknown/unhandled exception."
+ << std::endl;
+ }
+
+#ifdef HAS_EXECINFO_H
+ void * array[50];
+ int size = backtrace(array, 50);
+
+ printBacktrace(array, size);
+#endif
+ abort();
+}
+
+void printUsageAndExit() {
+ printf("uscxml-browser version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n");
+ printf("Usage\n");
+ printf("\tuscxml-browser");
+#ifdef BUILD_AS_PLUGINS
+ printf(" [-d pluginPath]");
+#endif
+ printf(" URL\n");
+ printf("\n");
+ printf("Options\n");
+ printf("\t-v : be verbose\n");
+ printf("\t-pN : port for HTTP server\n");
+ printf("\n");
+ exit(1);
+}
+
+int main(int argc, char** argv) {
+ using namespace uscxml;
+
+ std::set_terminate(customTerminate);
+
+#if defined(HAS_SIGNAL_H) && !defined(WIN32)
+ signal(SIGPIPE, SIG_IGN);
+#endif
+
+ if (argc < 2) {
+ printUsageAndExit();
+ }
+
+ bool verbose = false;
+ size_t port = 8080;
+ google::InitGoogleLogging(argv[0]);
+ google::LogToStderr();
+
+#ifndef _WIN32
+ opterr = 0;
+#endif
+ int option;
+ while ((option = getopt(argc, argv, "vl:d:p:")) != -1) {
+ switch(option) {
+ case 'l':
+ google::InitGoogleLogging(optarg);
+ break;
+ case 'd':
+ uscxml::Factory::pluginPath = optarg;
+ break;
+ case 'p':
+ port = strTo<size_t>(optarg);
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case '?':
+ break;
+ default:
+ printUsageAndExit();
+ break;
+ }
+ }
+
+ // intialize http server on given port
+ HTTPServer::getInstance(port);
+
+ LOG(INFO) << "Processing " << argv[optind];
+ Interpreter protoInterpreter = Interpreter::fromURI(argv[optind]);
+ if (protoInterpreter) {
+ MMISessionManager mmiSessionManager(protoInterpreter);
+ while(true)
+ tthread::this_thread::sleep_for(tthread::chrono::milliseconds(1000));
+ }
+
+ return EXIT_SUCCESS;
+} \ No newline at end of file
diff --git a/apps/w3c-mmi/mc/uscxml-modality-component.cpp b/apps/w3c-mmi/mc/uscxml-modality-component.cpp
new file mode 100644
index 0000000..afe4e7f
--- /dev/null
+++ b/apps/w3c-mmi/mc/uscxml-modality-component.cpp
@@ -0,0 +1,191 @@
+#include "uscxml/config.h"
+#include "uscxml/Interpreter.h"
+#include <glog/logging.h>
+
+#ifdef HAS_SIGNAL_H
+#include <signal.h>
+#endif
+
+#ifdef HAS_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+#ifdef HAS_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#ifdef _WIN32
+#include "XGetopt.h"
+#endif
+
+class VerboseMonitor : public uscxml::InterpreterMonitor {
+ void onStableConfiguration(uscxml::Interpreter interpreter) {
+ printConfig(interpreter.getConfiguration());
+ }
+
+ void beforeCompletion(uscxml::Interpreter interpreter) {
+ printConfig(interpreter.getConfiguration());
+ }
+
+ void printConfig(const Arabica::XPath::NodeSet<std::string>& config) {
+ std::string seperator;
+ std::cout << "Config: {";
+ for (int i = 0; i < config.size(); i++) {
+ std::cout << seperator << ATTR(config[i], "id");
+ seperator = ", ";
+ }
+ std::cout << "}" << std::endl;
+ }
+};
+
+
+#ifdef HAS_EXECINFO_H
+void printBacktrace(void** array, int size) {
+ char** messages = backtrace_symbols(array, size);
+ for (int i = 0; i < size && messages != NULL; ++i) {
+ std::cerr << "\t" << messages[i] << std::endl;
+ }
+ std::cerr << std::endl;
+ free(messages);
+}
+
+#ifdef HAS_DLFCN_H
+// see https://gist.github.com/nkuln/2020860
+typedef void (*cxa_throw_type)(void *, void *, void (*) (void *));
+cxa_throw_type orig_cxa_throw = 0;
+
+void load_orig_throw_code() {
+ orig_cxa_throw = (cxa_throw_type) dlsym(RTLD_NEXT, "__cxa_throw");
+}
+
+extern "C"
+void __cxa_throw (void *thrown_exception, void *pvtinfo, void (*dest)(void *)) {
+ std::cerr << __FUNCTION__ << " will throw exception from " << std::endl;
+ if (orig_cxa_throw == 0)
+ load_orig_throw_code();
+
+ void *array[50];
+ size_t size = backtrace(array, 50);
+ printBacktrace(array, size);
+ orig_cxa_throw(thrown_exception, pvtinfo, dest);
+}
+#endif
+#endif
+
+
+// see http://stackoverflow.com/questions/2443135/how-do-i-find-where-an-exception-was-thrown-in-c
+void customTerminate() {
+ static bool tried_throw = false;
+ try {
+ // try once to re-throw currently active exception
+ if (!tried_throw) {
+ throw;
+ tried_throw = true;
+ } else {
+ tried_throw = false;
+ };
+ } catch (const std::exception &e) {
+ std::cerr << __FUNCTION__ << " caught unhandled exception. what(): "
+ << e.what() << std::endl;
+ } catch (const uscxml::Event &e) {
+ std::cerr << __FUNCTION__ << " caught unhandled exception. Event: "
+ << e << std::endl;
+ } catch (...) {
+ std::cerr << __FUNCTION__ << " caught unknown/unhandled exception."
+ << std::endl;
+ }
+
+#ifdef HAS_EXECINFO_H
+ void * array[50];
+ int size = backtrace(array, 50);
+
+ printBacktrace(array, size);
+#endif
+ abort();
+}
+
+void printUsageAndExit() {
+ printf("uscxml-browser version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n");
+ printf("Usage\n");
+ printf("\tuscxml-browser");
+#ifdef BUILD_AS_PLUGINS
+ printf(" [-d pluginPath]");
+#endif
+ printf(" URL\n");
+ printf("\n");
+ printf("Options\n");
+ printf("\t-v : be verbose\n");
+ printf("\t-pN : port for HTTP server\n");
+ printf("\n");
+ exit(1);
+}
+
+int main(int argc, char** argv) {
+ using namespace uscxml;
+
+ std::set_terminate(customTerminate);
+
+#if defined(HAS_SIGNAL_H) && !defined(WIN32)
+ signal(SIGPIPE, SIG_IGN);
+#endif
+
+ if (argc < 2) {
+ printUsageAndExit();
+ }
+
+ bool verbose = false;
+ size_t port = 8080;
+ google::InitGoogleLogging(argv[0]);
+ google::LogToStderr();
+
+#ifndef _WIN32
+ opterr = 0;
+#endif
+ int option;
+ while ((option = getopt(argc, argv, "vl:d:p:")) != -1) {
+ switch(option) {
+ case 'l':
+ google::InitGoogleLogging(optarg);
+ break;
+ case 'd':
+ uscxml::Factory::pluginPath = optarg;
+ break;
+ case 'p':
+ port = strTo<size_t>(optarg);
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case '?':
+ break;
+ default:
+ printUsageAndExit();
+ break;
+ }
+ }
+
+// for (int i = 0; i < argc; i++)
+// std::cout << argv[i] << std::endl;
+// std::cout << optind << std::endl;
+
+ // intialize http server on given port
+ HTTPServer::getInstance(port);
+
+ LOG(INFO) << "Processing " << argv[optind];
+ Interpreter interpreter = Interpreter::fromURI(argv[optind]);
+ if (interpreter) {
+ interpreter.setCmdLineOptions(argc, argv);
+// interpreter->setCapabilities(Interpreter::CAN_NOTHING);
+// interpreter->setCapabilities(Interpreter::CAN_BASIC_HTTP | Interpreter::CAN_GENERIC_HTTP);
+
+ if (verbose) {
+ VerboseMonitor* vm = new VerboseMonitor();
+ interpreter.addMonitor(vm);
+ }
+
+ interpreter.start();
+ while(interpreter.runOnMainThread(25));
+ }
+
+ return EXIT_SUCCESS;
+} \ No newline at end of file
diff --git a/contrib/dom/idl/Node.idl b/contrib/dom/idl/Node.idl
index 0302e5e..f819441 100644
--- a/contrib/dom/idl/Node.idl
+++ b/contrib/dom/idl/Node.idl
@@ -26,7 +26,7 @@ interface Node {
readonly attribute Node lastChild;
readonly attribute Node previousSibling;
readonly attribute Node nextSibling;
- readonly attribute NamedNodeMap attributes;
+ [CustomGetter] readonly attribute NamedNodeMap attributes;
// Modified in DOM Level 2:
readonly attribute Document ownerDocument;
Node insertBefore(in Node newChild,
diff --git a/contrib/local/compress_and_upload_deps.sh b/contrib/local/compress_and_upload_deps.sh
index 9f64118..ae53c7f 100755
--- a/contrib/local/compress_and_upload_deps.sh
+++ b/contrib/local/compress_and_upload_deps.sh
@@ -8,8 +8,8 @@ CWD=`pwd`
cd $DIR
-if [ "$UMUNDO_PREBUILT_HOST" == "" ]; then
- UMUNDO_PREBUILT_HOST="admin@uscxml.tk.informatik.tu-darmstadt.de:/var/www/html/uscxml/prebuilt"
+if [ "$USCXML_PREBUILT_HOST" == "" ]; then
+ USCXML_PREBUILT_HOST="admin@uscxml.tk.informatik.tu-darmstadt.de:/var/www/html/uscxml/prebuilt"
fi
if [ "$1" == "" ] || [ "$2" == "" ]; then
@@ -32,7 +32,7 @@ for FILE in ${PLATFORMS}; do
if [ "$PLATFORM" != "include" ]; then
echo $FILE
tar cvzf uscxml-prebuilt-${PLATFORM}.tgz ${FILE}
- scp uscxml-prebuilt-${PLATFORM}.tgz ${UMUNDO_PREBUILT_HOST}/${VERSION}
+ scp uscxml-prebuilt-${PLATFORM}.tgz ${USCXML_PREBUILT_HOST}/${VERSION}
rm uscxml-prebuilt-${PLATFORM}.tgz
fi
done \ No newline at end of file
diff --git a/docs/BUILDING.md b/docs/BUILDING.md
index c7415b1..a9096eb 100644
--- a/docs/BUILDING.md
+++ b/docs/BUILDING.md
@@ -154,7 +154,7 @@ This would be all distributions based on Debian, like Ubuntu, Linux Mint and the
$ sudo apt-get install git cmake cmake-curses-gui make g++
# uscxml required dependencies
- $ sudo apt-get install libxml2-dev
+ $ sudo apt-get install libxml2-dev libcurl4-openssl-dev
There may still be packages missing due to the set of dependencies among packages
in the various distributons. Try to run cmake and resolve dependencies until you
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 9c59259..5ad5e9a 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -11,6 +11,7 @@
#else
# include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
+# include "uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h"
# include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h"
# include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h"
# include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
@@ -56,12 +57,24 @@
# include "uscxml/plugins/element/respond/RespondElement.h"
# include "uscxml/plugins/element/postpone/PostponeElement.h"
+# if 0
+# include "uscxml/plugins/element/mmi/MMIEvents.h"
+# endif
#endif
+#define ELEMENT_MMI_REGISTER(class)\
+class##Element* class = new class##Element(); \
+registerExecutableContent(class);
+
+
namespace uscxml {
+Factory::Factory(Factory* parentFactory) : _parentFactory(parentFactory) {
+}
+
Factory::Factory() {
+ _parentFactory = NULL;
#ifdef BUILD_AS_PLUGINS
if (pluginPath.length() == 0) {
// try to read USCXML_PLUGIN_PATH environment variable
@@ -187,6 +200,10 @@ Factory::Factory() {
registerIOProcessor(ioProcessor);
}
{
+ MMIHTTPIOProcessor* ioProcessor = new MMIHTTPIOProcessor();
+ registerIOProcessor(ioProcessor);
+ }
+ {
SCXMLIOProcessor* ioProcessor = new SCXMLIOProcessor();
registerIOProcessor(ioProcessor);
}
@@ -207,6 +224,29 @@ Factory::Factory() {
registerExecutableContent(element);
}
+#if 0
+ {
+ ELEMENT_MMI_REGISTER(PrepareRequest);
+ ELEMENT_MMI_REGISTER(StartRequest);
+ ELEMENT_MMI_REGISTER(PauseRequest);
+ ELEMENT_MMI_REGISTER(ResumeRequest);
+ ELEMENT_MMI_REGISTER(CancelRequest);
+ ELEMENT_MMI_REGISTER(ClearContextRequest);
+ ELEMENT_MMI_REGISTER(StatusRequest);
+ ELEMENT_MMI_REGISTER(NewContextResponse);
+ ELEMENT_MMI_REGISTER(PrepareResponse);
+ ELEMENT_MMI_REGISTER(StartResponse);
+ ELEMENT_MMI_REGISTER(PauseResponse);
+ ELEMENT_MMI_REGISTER(ResumeResponse);
+ ELEMENT_MMI_REGISTER(CancelResponse);
+ ELEMENT_MMI_REGISTER(ClearContextResponse);
+ ELEMENT_MMI_REGISTER(StatusResponse);
+ ELEMENT_MMI_REGISTER(DoneNotification);
+ ELEMENT_MMI_REGISTER(NewContextRequest);
+ ELEMENT_MMI_REGISTER(ExtensionNotification);
+ }
+#endif
+
#endif
}
@@ -261,63 +301,96 @@ void Factory::registerExecutableContent(ExecutableContentImpl* executableContent
_executableContent[std::make_pair(localName, nameSpace)] = executableContent;
}
+std::map<std::string, IOProcessorImpl*> Factory::getIOProcessors() {
+ std::map<std::string, IOProcessorImpl*> ioProcs;
+ if (_parentFactory) {
+ ioProcs = _parentFactory->getIOProcessors();
+ }
+
+ std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = _ioProcessors.begin();
+ while(ioProcIter != _ioProcessors.end()) {
+ ioProcs.insert(std::make_pair(ioProcIter->first, ioProcIter->second));
+ ioProcIter++;
+ }
+
+ return ioProcs;
+}
boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, InterpreterImpl* interpreter) {
- Factory* factory = getInstance();
- if (factory->_invokerAliases.find(type) == factory->_invokerAliases.end()) {
- LOG(ERROR) << "No " << type << " Invoker known";
- return boost::shared_ptr<InvokerImpl>();
+
+ // do we have this type ourself?
+ if (_invokerAliases.find(type) != _invokerAliases.end()) {
+ std::string canonicalName = _invokerAliases[type];
+ if (_invokers.find(canonicalName) != _invokers.end()) {
+ return _invokers[canonicalName]->create(interpreter);
+ }
}
- std::string canonicalName = factory->_invokerAliases[type];
- if (factory->_invokers.find(canonicalName) == factory->_invokers.end()) {
- LOG(ERROR) << "Invoker " << type << " known as " << canonicalName << " but no prototype is available in factory";
- return boost::shared_ptr<InvokerImpl>();
+ // lookup in parent factory
+ if (_parentFactory) {
+ return _parentFactory->createInvoker(type, interpreter);
+ } else {
+ LOG(ERROR) << "No " << type << " Invoker known";
}
-
- return boost::static_pointer_cast<InvokerImpl>(factory->_invokers[canonicalName]->create(interpreter));
+
+ return boost::shared_ptr<InvokerImpl>();
}
boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, InterpreterImpl* interpreter) {
- Factory* factory = getInstance();
- if (factory->_dataModelAliases.find(type) == factory->_dataModelAliases.end()) {
- LOG(ERROR) << "No " << type << " DataModel known";
- return boost::shared_ptr<DataModelImpl>();
+
+ // do we have this type ourself?
+ if (_dataModelAliases.find(type) != _dataModelAliases.end()) {
+ std::string canonicalName = _dataModelAliases[type];
+ if (_dataModels.find(canonicalName) != _dataModels.end()) {
+ return _dataModels[canonicalName]->create(interpreter);
+ }
}
-
- std::string canonicalName = factory->_dataModelAliases[type];
- if (factory->_dataModels.find(canonicalName) == factory->_dataModels.end()) {
- LOG(ERROR) << "DataModel " << type << " known as " << canonicalName << " but no prototype is available in factory";
- return boost::shared_ptr<DataModelImpl>();
+
+ // lookup in parent factory
+ if (_parentFactory) {
+ return _parentFactory->createDataModel(type, interpreter);
+ } else {
+ LOG(ERROR) << "No " << type << " Datamodel known";
}
-
- return factory->_dataModels[canonicalName]->create(interpreter);
+
+ return boost::shared_ptr<DataModelImpl>();
}
boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string& type, InterpreterImpl* interpreter) {
- Factory* factory = getInstance();
- if (factory->_ioProcessorAliases.find(type) == factory->_ioProcessorAliases.end()) {
- LOG(ERROR) << "No " << type << " IOProcessor known";
- return boost::shared_ptr<IOProcessorImpl>();
+ // do we have this type ourself?
+ if (_ioProcessorAliases.find(type) != _ioProcessorAliases.end()) {
+ std::string canonicalName = _ioProcessorAliases[type];
+ if (_ioProcessors.find(canonicalName) != _ioProcessors.end()) {
+ return _ioProcessors[canonicalName]->create(interpreter);
+ }
}
-
- std::string canonicalName = factory->_ioProcessorAliases[type];
- if (factory->_ioProcessors.find(canonicalName) == factory->_ioProcessors.end()) {
- LOG(ERROR) << "IOProcessor " << type << " known as " << canonicalName << " but no prototype is available in factory";
- return boost::shared_ptr<IOProcessorImpl>();
+
+ // lookup in parent factory
+ if (_parentFactory) {
+ return _parentFactory->createIOProcessor(type, interpreter);
+ } else {
+ LOG(ERROR) << "No " << type << " Datamodel known";
}
-
- return factory->_ioProcessors[canonicalName]->create(interpreter);
+
+ return boost::shared_ptr<IOProcessorImpl>();
}
boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter) {
- Factory* factory = getInstance();
+ // do we have this type in this factory?
std::string actualNameSpace = (nameSpace.length() == 0 ? "http://www.w3.org/2005/07/scxml" : nameSpace);
- if (factory->_executableContent.find(std::make_pair(localName, actualNameSpace)) == factory->_executableContent.end()) {
+ if (_executableContent.find(std::make_pair(localName, actualNameSpace)) != _executableContent.end()) {
+ return _executableContent[std::make_pair(localName, actualNameSpace)]->create(interpreter);
+ }
+
+ // lookup in parent factory
+ if (_parentFactory) {
+ return _parentFactory->createExecutableContent(localName, nameSpace, interpreter);
+ } else {
LOG(ERROR) << "Executable content " << localName << " in " << actualNameSpace << " not available in factory";
- return boost::shared_ptr<ExecutableContentImpl>();
}
- return factory->_executableContent[std::make_pair(localName, actualNameSpace)]->create(interpreter);
+
+ return boost::shared_ptr<ExecutableContentImpl>();
+
}
@@ -328,7 +401,7 @@ Factory* Factory::getInstance() {
return _instance;
}
-void IOProcessorImpl::returnEvent(Event& event) {
+void EventHandlerImpl::returnEvent(Event& event) {
if (event.invokeid.length() == 0)
event.invokeid = _invokeId;
if (event.type == 0)
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h
index 59835b3..d92d105 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/Factory.h
@@ -103,11 +103,8 @@ protected:
};
-class IOProcessorImpl {
+class EventHandlerImpl {
public:
- IOProcessorImpl() {};
- virtual ~IOProcessorImpl() {};
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0;
virtual std::set<std::string> getNames() = 0;
virtual void setInterpreter(InterpreterImpl* interpreter) {
@@ -119,48 +116,31 @@ public:
void setType(const std::string& type) {
_type = type;
}
-
+
virtual Data getDataModelVariables() = 0;
virtual void send(const SendRequest& req) = 0;
-
+
virtual void runOnMainThread() {};
-
void returnEvent(Event& event);
-
+
protected:
InterpreterImpl* _interpreter;
std::string _invokeId;
std::string _type;
+
};
-class IOProcessor {
+class EventHandler {
public:
- IOProcessor() : _impl() {}
- IOProcessor(boost::shared_ptr<IOProcessorImpl> const impl) : _impl(impl) { }
- IOProcessor(const IOProcessor& other) : _impl(other._impl) { }
- virtual ~IOProcessor() {};
-
- operator bool() const {
- return _impl;
- }
- bool operator< (const IOProcessor& other) const {
- return _impl < other._impl;
- }
- bool operator==(const IOProcessor& other) const {
- return _impl == other._impl;
- }
- bool operator!=(const IOProcessor& other) const {
- return _impl != other._impl;
- }
- IOProcessor& operator= (const IOProcessor& other) {
- _impl = other._impl;
- return *this;
- }
-
+ EventHandler() : _impl() {}
+ EventHandler(boost::shared_ptr<EventHandlerImpl> const impl) : _impl(impl) { }
+ EventHandler(const EventHandler& other) : _impl(other._impl) { }
+ virtual ~EventHandler() {};
+
virtual std::set<std::string> getNames() {
return _impl->getNames();
}
-
+
virtual Data getDataModelVariables() const {
return _impl->getDataModelVariables();
};
@@ -170,7 +150,7 @@ public:
virtual void runOnMainThread() {
return _impl->runOnMainThread();
}
-
+
void setInterpreter(InterpreterImpl* interpreter) {
_impl->setInterpreter(interpreter);
}
@@ -182,21 +162,58 @@ public:
}
protected:
+ boost::shared_ptr<EventHandlerImpl> _impl;
+ friend class InterpreterImpl;
+};
+
+class IOProcessorImpl : public EventHandlerImpl {
+public:
+ IOProcessorImpl() {};
+ virtual ~IOProcessorImpl() {};
+ virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0;
+};
+
+class IOProcessor : public EventHandler {
+public:
+ IOProcessor() : _impl() {}
+ IOProcessor(boost::shared_ptr<IOProcessorImpl> const impl) : EventHandler(impl), _impl(impl) { }
+ IOProcessor(const IOProcessor& other) : EventHandler(other._impl), _impl(other._impl) { }
+ virtual ~IOProcessor() {};
+
+ operator bool() const {
+ return _impl;
+ }
+ bool operator< (const IOProcessor& other) const {
+ return _impl < other._impl;
+ }
+ bool operator==(const IOProcessor& other) const {
+ return _impl == other._impl;
+ }
+ bool operator!=(const IOProcessor& other) const {
+ return _impl != other._impl;
+ }
+ IOProcessor& operator= (const IOProcessor& other) {
+ _impl = other._impl;
+ EventHandler::_impl = _impl;
+ return *this;
+ }
+
+protected:
boost::shared_ptr<IOProcessorImpl> _impl;
friend class InterpreterImpl;
};
-class InvokerImpl : public IOProcessorImpl {
+class InvokerImpl : public EventHandlerImpl {
public:
virtual void invoke(const InvokeRequest& req) = 0;
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter) = 0;
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter) = 0;
};
-class Invoker : public IOProcessor {
+class Invoker : public EventHandler {
public:
Invoker() : _impl() {}
- Invoker(boost::shared_ptr<InvokerImpl> const impl) : IOProcessor(impl), _impl(impl) { }
- Invoker(const Invoker& other) : IOProcessor(other._impl), _impl(other._impl) { }
+ Invoker(boost::shared_ptr<InvokerImpl> const impl) : EventHandler(impl), _impl(impl) { }
+ Invoker(const Invoker& other) : EventHandler(other._impl), _impl(other._impl) { }
virtual ~Invoker() {};
operator bool() const {
@@ -213,7 +230,7 @@ public:
}
Invoker& operator= (const Invoker& other) {
_impl = other._impl;
- IOProcessor::_impl = _impl;
+ EventHandler::_impl = _impl;
return *this;
}
@@ -352,16 +369,20 @@ protected:
class Factory {
public:
+ Factory(Factory* parentFactory);
+
void registerIOProcessor(IOProcessorImpl* ioProcessor);
void registerDataModel(DataModelImpl* dataModel);
void registerInvoker(InvokerImpl* invoker);
void registerExecutableContent(ExecutableContentImpl* executableContent);
- static boost::shared_ptr<DataModelImpl> createDataModel(const std::string& type, InterpreterImpl* interpreter);
- static boost::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, InterpreterImpl* interpreter);
- static boost::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InterpreterImpl* interpreter);
- static boost::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter);
+ boost::shared_ptr<DataModelImpl> createDataModel(const std::string& type, InterpreterImpl* interpreter);
+ boost::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, InterpreterImpl* interpreter);
+ boost::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InterpreterImpl* interpreter);
+ boost::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter);
+ std::map<std::string, IOProcessorImpl*> getIOProcessors();
+
static Factory* getInstance();
std::map<std::string, DataModelImpl*> _dataModels;
@@ -381,6 +402,7 @@ protected:
Factory();
~Factory();
+ Factory* _parentFactory;
static Factory* _instance;
};
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index dea7299..8bb6499 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -1,6 +1,7 @@
#include "uscxml/Common.h"
#include "uscxml/Interpreter.h"
#include "uscxml/URL.h"
+#include "uscxml/NameSpacingParser.h"
#include "uscxml/debug/SCXMLDotWriter.h"
#include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
@@ -59,6 +60,7 @@ InterpreterImpl::InterpreterImpl() {
_done = true;
_isInitialized = false;
_httpServlet = NULL;
+ _factory = NULL;
_capabilities = CAN_BASIC_HTTP | CAN_GENERIC_HTTP;
#ifdef _WIN32
@@ -131,18 +133,9 @@ Interpreter Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string>&
tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
boost::shared_ptr<InterpreterDraft6> interpreterImpl = boost::shared_ptr<InterpreterDraft6>(new InterpreterDraft6);
Interpreter interpreter;
- SCXMLParser* parser = new SCXMLParser(interpreterImpl.get());
- if(!parser->parse(source) || !parser->getDocument().hasChildNodes()) {
- if(parser->_errorHandler.errorsReported()) {
- LOG(ERROR) << "could not parse input:";
- LOG(ERROR) << parser->_errorHandler.errors() << std::endl;
- } else {
- Arabica::SAX::InputSourceResolver resolver(source, Arabica::default_string_adaptor<std::string>());
- if (!resolver.resolve()) {
- LOG(ERROR) << source.getSystemId() << ": no such file";
- }
- }
- } else {
+ NameSpacingParser* parser = new NameSpacingParser();
+ if (parser->parse(source) && parser->getDocument() && parser->getDocument().hasChildNodes()) {
+ interpreterImpl->setNameSpaceInfo(parser->nameSpace);
interpreterImpl->_document = parser->getDocument();
interpreterImpl->init();
interpreter = Interpreter(interpreterImpl);
@@ -153,32 +146,32 @@ Interpreter Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string>&
return interpreter;
}
-SCXMLParser::SCXMLParser(InterpreterImpl* interpreter) : _interpreter(interpreter) {
- Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
- setErrorHandler(errorHandler);
-}
-
-void SCXMLParser::startPrefixMapping(const std::string& prefix, const std::string& uri) {
-#if 0
- std::cout << "starting prefix mapping " << prefix << ": " << uri << std::endl;
-#endif
- if (boost::iequals(uri, "http://www.w3.org/2005/07/scxml")) {
- _interpreter->_nsURL = uri;
- if (prefix.size() == 0) {
- LOG(INFO) << "Mapped default namespace to 'scxml:'";
- _interpreter->_xpathPrefix = "scxml:";
- _interpreter->_nsContext.addNamespaceDeclaration(uri, "scxml");
- _interpreter->_nsToPrefix[uri] = "scxml";
+void InterpreterImpl::setNameSpaceInfo(const std::map<std::string, std::string> namespaceInfo) {
+ _nameSpaceInfo = namespaceInfo;
+ std::map<std::string, std::string>::const_iterator nsIter = namespaceInfo.begin();
+ while(nsIter != namespaceInfo.end()) {
+ std::string uri = nsIter->first;
+ std::string prefix = nsIter->second;
+ if (boost::iequals(uri, "http://www.w3.org/2005/07/scxml")) {
+ _nsURL = uri;
+ if (prefix.size() == 0) {
+ LOG(INFO) << "Mapped default namespace to 'scxml:'";
+ _xpathPrefix = "scxml:";
+ _nsContext.addNamespaceDeclaration(uri, "scxml");
+ _nsToPrefix[uri] = "scxml";
+ } else {
+ _xpathPrefix = prefix + ":";
+ _xmlNSPrefix = _xpathPrefix;
+ _nsContext.addNamespaceDeclaration(uri, prefix);
+ _nsToPrefix[uri] = prefix;
+ }
} else {
- _interpreter->_xpathPrefix = prefix + ":";
- _interpreter->_xmlNSPrefix = _interpreter->_xpathPrefix;
- _interpreter->_nsContext.addNamespaceDeclaration(uri, prefix);
- _interpreter->_nsToPrefix[uri] = prefix;
+ _nsContext.addNamespaceDeclaration(uri, prefix);
+ _nsToPrefix[uri] = prefix;
}
- } else {
- _interpreter->_nsContext.addNamespaceDeclaration(uri, prefix);
- _interpreter->_nsToPrefix[uri] = prefix;
+ nsIter++;
}
+
}
void InterpreterImpl::setName(const std::string& name) {
@@ -261,9 +254,13 @@ void InterpreterImpl::init() {
normalize(_scxml);
+ // setup event queue for delayed send
_sendQueue = new DelayedEventQueue();
_sendQueue->start();
+ if (_factory == NULL)
+ _factory = Factory::getInstance();
+
} else {
LOG(ERROR) << "Cannot find SCXML element" << std::endl;
_done = true;
@@ -480,7 +477,7 @@ void InterpreterImpl::processDOMorText(const Arabica::DOM::Node<std::string>& no
Node<std::string> container = dom.createElement("container");
dom.replaceChild(container, content);
container.appendChild(content);
- std::cout << dom << std::endl;
+// std::cout << dom << std::endl;
return;
} else {
text = srcContent.str();
@@ -830,7 +827,7 @@ void InterpreterImpl::invoke(const Arabica::DOM::Node<std::string>& element) {
if (invokeReq.type.size() == 0)
invokeReq.type = "http://www.w3.org/TR/scxml/";
- Invoker invoker(Factory::createInvoker(invokeReq.type, this));
+ Invoker invoker(_factory->createInvoker(invokeReq.type, this));
if (invoker) {
tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
try {
@@ -1159,7 +1156,7 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node<std::string>& cont
// --- Custom Executable Content
ExecutableContent execContent;
if (_executableContent.find(content) == _executableContent.end()) {
- execContent = Factory::createExecutableContent(content.getLocalName(), content.getNamespaceURI(), this);
+ execContent = _factory->createExecutableContent(content.getLocalName(), content.getNamespaceURI(), this);
if (!execContent) {
LOG(ERROR) << "No custom executable content known for element '"
<< content.getLocalName() << "' in namespace '" << content.getNamespaceURI() << "'";
@@ -1620,8 +1617,9 @@ bool InterpreterImpl::isCompound(const Arabica::DOM::Node<std::string>& state) {
void InterpreterImpl::setupIOProcessors() {
tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
- std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = Factory::getInstance()->_ioProcessors.begin();
- while(ioProcIter != Factory::getInstance()->_ioProcessors.end()) {
+ std::map<std::string, IOProcessorImpl*> ioProcs = _factory->getIOProcessors();
+ std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = ioProcs.begin();
+ while(ioProcIter != ioProcs.end()) {
if (boost::iequals(ioProcIter->first, "basichttp") && !(_capabilities & CAN_BASIC_HTTP)) {
ioProcIter++;
continue;
@@ -1631,7 +1629,7 @@ void InterpreterImpl::setupIOProcessors() {
continue;
}
- _ioProcessors[ioProcIter->first] = Factory::createIOProcessor(ioProcIter->first, this);
+ _ioProcessors[ioProcIter->first] = _factory->createIOProcessor(ioProcIter->first, this);
_ioProcessors[ioProcIter->first].setType(ioProcIter->first);
_ioProcessors[ioProcIter->first].setInterpreter(this);
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index d88fe10..7c95426 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -56,15 +56,6 @@ public:
std::string unit;
};
-class SCXMLParser : public Arabica::SAX2DOM::Parser<std::string> {
-public:
- SCXMLParser(InterpreterImpl* interpreter);
- void startPrefixMapping(const std::string& /* prefix */, const std::string& /* uri */);
-
- Arabica::SAX::CatchErrorHandler<std::string> _errorHandler;
- InterpreterImpl* _interpreter;
-};
-
enum Capabilities {
CAN_NOTHING = 0,
CAN_BASIC_HTTP = 1,
@@ -123,6 +114,12 @@ public:
void setParentQueue(uscxml::concurrency::BlockingQueue<SendRequest>* parentQueue) {
_parentQueue = parentQueue;
}
+ void setFactory(Factory* factory) {
+ _factory = factory;
+ }
+ Factory* getFactory() {
+ return _factory;
+ }
std::string getXPathPrefix() {
return _xpathPrefix;
}
@@ -137,7 +134,9 @@ public:
return _nsToPrefix[ns] + ":";
return "";
}
-
+ void setNameSpaceInfo(const std::map<std::string, std::string> nameSpaceInfo);
+ std::map<std::string, std::string> getNameSpaceInfo() { return _nameSpaceInfo; }
+
void receiveInternal(const Event& event);
void receive(const Event& event, bool toFront = false);
@@ -252,6 +251,7 @@ protected:
std::string _xpathPrefix; // prefix mapped for xpath, "scxml" is _xmlNSPrefix is empty but _nsURL set
std::string _nsURL; // ough to be "http://www.w3.org/2005/07/scxml"
std::map<std::string, std::string> _nsToPrefix;
+ std::map<std::string, std::string> _nameSpaceInfo;
bool _running;
bool _done;
@@ -271,6 +271,7 @@ protected:
DelayedEventQueue* _sendQueue;
Event _currEvent;
+ Factory* _factory;
InterpreterServlet* _httpServlet;
std::set<InterpreterMonitor*> _monitors;
@@ -321,7 +322,6 @@ protected:
std::map<std::string, Arabica::DOM::Node<std::string> > _cachedStates;
std::map<std::string, URL> _cachedURLs;
- friend class SCXMLParser;
friend class USCXMLInvoker;
friend class SCXMLIOProcessor;
friend class Interpreter;
@@ -385,6 +385,13 @@ public:
return _impl->getBaseURI();
}
+ void setNameSpaceInfo(const std::map<std::string, std::string> namespaceInfo) {
+ _impl->setNameSpaceInfo(namespaceInfo);
+ }
+ std::map<std::string, std::string> getNameSpaceInfo() {
+ return _impl->getNameSpaceInfo();
+ }
+
void setCmdLineOptions(int argc, char** argv) {
return _impl->setCmdLineOptions(argc, argv);
}
@@ -402,6 +409,12 @@ public:
void setParentQueue(uscxml::concurrency::BlockingQueue<SendRequest>* parentQueue) {
return _impl->setParentQueue(parentQueue);
}
+ void setFactory(Factory* factory) {
+ return _impl->setFactory(factory);
+ }
+ Factory* getFactory() {
+ return _impl->getFactory();
+ }
std::string getXPathPrefix() {
return _impl->getXPathPrefix();
}
@@ -566,7 +579,6 @@ public:
return InterpreterImpl::getUUID();
}
-#ifndef SWIG
boost::shared_ptr<InterpreterImpl> getImpl() {
return _impl;
}
@@ -584,8 +596,6 @@ public:
return _instances;
}
-#endif
-
protected:
boost::shared_ptr<InterpreterImpl> _impl;
static std::map<std::string, boost::weak_ptr<InterpreterImpl> > _instances;
diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h
index 1d8cb53..0f82947 100644
--- a/src/uscxml/Message.h
+++ b/src/uscxml/Message.h
@@ -35,6 +35,33 @@ public:
return (atom.length() > 0 || !compound.empty() || !array.empty());
}
+ bool hasKey(const std::string& key) const {
+ return (!compound.empty() && compound.find(key) != compound.end());
+ }
+
+ const Data operator[](const std::string& key) const {
+ return operator[](key.c_str());
+ }
+
+ const Data operator[](const char* key) const {
+ if (hasKey(key))
+ return compound.at(key);
+ Data data;
+ return data;
+ }
+
+ operator std::string() {
+ return atom;
+ }
+
+ operator std::map<std::string, Data>() {
+ return compound;
+ }
+
+ operator std::list<Data>() {
+ return array;
+ }
+
static Data fromJSON(const std::string& jsonString);
static Data fromXML(const std::string& xmlString);
Arabica::DOM::Document<std::string> toDocument();
diff --git a/src/uscxml/NameSpacingParser.cpp b/src/uscxml/NameSpacingParser.cpp
new file mode 100644
index 0000000..21d9704
--- /dev/null
+++ b/src/uscxml/NameSpacingParser.cpp
@@ -0,0 +1,44 @@
+#include "NameSpacingParser.h"
+#include <glog/logging.h>
+
+namespace uscxml {
+
+ NameSpacingParser* NameSpacingParser::fromXML(const std::string& xml) {
+ if (xml.length() == 0)
+ return NULL;
+ std::stringstream* ss = new std::stringstream();
+ (*ss) << xml;
+ // we need an auto_ptr for arabica to assume ownership
+ std::auto_ptr<std::istream> ssPtr(ss);
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setByteStream(ssPtr);
+ return fromInputSource(inputSource);
+ }
+
+ NameSpacingParser* NameSpacingParser::fromInputSource(Arabica::SAX::InputSource<std::string>& source) {
+ NameSpacingParser* parser = new NameSpacingParser();
+ if(!parser->parse(source) || !parser->getDocument().hasChildNodes()) {
+ if(parser->_errorHandler.errorsReported()) {
+ LOG(ERROR) << "could not parse input:";
+ LOG(ERROR) << parser->_errorHandler.errors() << std::endl;
+ } else {
+ Arabica::SAX::InputSourceResolver resolver(source, Arabica::default_string_adaptor<std::string>());
+ if (!resolver.resolve()) {
+ LOG(ERROR) << source.getSystemId() << ": no such file";
+ }
+ }
+ delete parser;
+ }
+ return parser;
+ }
+
+ NameSpacingParser::NameSpacingParser() {
+ Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
+ setErrorHandler(errorHandler);
+ }
+
+ void NameSpacingParser::startPrefixMapping(const std::string& prefix, const std::string& uri) {
+ nameSpace.insert(std::make_pair(uri, prefix));
+ }
+
+} \ No newline at end of file
diff --git a/src/uscxml/NameSpacingParser.h b/src/uscxml/NameSpacingParser.h
new file mode 100644
index 0000000..7dcefcf
--- /dev/null
+++ b/src/uscxml/NameSpacingParser.h
@@ -0,0 +1,26 @@
+#ifndef NAMESPACINGPARSER_H_1S91TNPM
+#define NAMESPACINGPARSER_H_1S91TNPM
+
+#include <DOM/SAX2DOM/SAX2DOM.hpp>
+#include <SAX/helpers/CatchErrorHandler.hpp>
+
+namespace uscxml {
+
+ class NameSpacingParser : public Arabica::SAX2DOM::Parser<std::string> {
+ public:
+ NameSpacingParser();
+ static NameSpacingParser* fromXML(const std::string& xml);
+ static NameSpacingParser* fromInputSource(Arabica::SAX::InputSource<std::string>& source);
+
+ void startPrefixMapping(const std::string& prefix, const std::string& uri);
+
+ Arabica::SAX::CatchErrorHandler<std::string> _errorHandler;
+ std::map<std::string, std::string> nameSpace;
+
+ private:
+ NameSpacingParser(const NameSpacingParser& other) {}
+ };
+
+}
+
+#endif /* end of include guard: NAMESPACINGPARSER_H_1S91TNPM */
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index 97223f8..fb6a637 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -14,6 +14,8 @@ void InterpreterDraft6::interpret() {
if (!_isInitialized)
init();
+// std::cout << _scxml << std::endl;
+
if (!_scxml) {
// _mutex.unlock();
return;
@@ -30,8 +32,11 @@ void InterpreterDraft6::interpret() {
datamodelName = ATTR(_scxml, "datamodel");
if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "profile")) // SCION SCXML uses profile to specify datamodel
datamodelName = ATTR(_scxml, "profile");
- if(datamodelName.length() > 0)
- _dataModel = Factory::createDataModel(datamodelName, this);
+ if(datamodelName.length() > 0) {
+ _dataModel = _factory->createDataModel(datamodelName, this);
+ } else {
+ _dataModel = _factory->createDataModel("null", this);
+ }
if(datamodelName.length() > 0 && !_dataModel) {
LOG(ERROR) << "No datamodel for " << datamodelName << " registered";
}
diff --git a/src/uscxml/interpreter/InterpreterDraft7.cpp b/src/uscxml/interpreter/InterpreterDraft7.cpp
index 2f8c7b2..7f16b1f 100644
--- a/src/uscxml/interpreter/InterpreterDraft7.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft7.cpp
@@ -38,8 +38,11 @@ void InterpreterDraft7::interpret() {
datamodelName = ATTR(_scxml, "datamodel");
if (datamodelName.length() == 0 && HAS_ATTR(_scxml, "profile")) // SCION SCXML uses profile to specify datamodel
datamodelName = ATTR(_scxml, "profile");
- if(datamodelName.length() > 0)
- _dataModel = Factory::createDataModel(datamodelName, this);
+ if(datamodelName.length() > 0) {
+ _dataModel = _factory->createDataModel(datamodelName, this);
+ } else {
+ _dataModel = _factory->createDataModel("null", this);
+ }
if(datamodelName.length() > 0 && !_dataModel) {
LOG(ERROR) << "No datamodel for " << datamodelName << " registered";
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
index bee6042..d16f81b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
@@ -5,59 +5,59 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
-v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getName().c_str());
-}
+ return v8::String::New(privData->nativeObj->getName().c_str());
+ }
-v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->getSpecified());
-}
+ return v8::Boolean::New(privData->nativeObj->getSpecified());
+ }
-v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getValue().c_str());
-}
+ return v8::String::New(privData->nativeObj->getValue().c_str());
+ }
-void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localValue(value);
- privData->nativeObj->setValue(*localValue);
-}
+ void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localValue(value);
+ privData->nativeObj->setValue(*localValue);
+ }
-v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getOwnerElement()) return v8::Undefined();
- Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
+ if (!privData->nativeObj->getOwnerElement()) return v8::Undefined();
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
+ }
+ bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
index 9829023..e317698 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
@@ -33,50 +33,50 @@ namespace DOM {
class V8Attr {
public:
- struct V8AttrPrivate {
- V8DOM* dom;
- Arabica::DOM::Attr<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8AttrPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Attr"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8AttrPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Attr<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8AttrPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Attr"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
index a9e5ac9..90495f4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
-bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
index 3b95b84..f9767a0 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8CDATASection {
public:
- struct V8CDATASectionPrivate {
- V8DOM* dom;
- Arabica::DOM::CDATASection<std::string>* nativeObj;
- };
+ struct V8CDATASectionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CDATASection<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8CDATASectionPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8CDATASectionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("CDATASection"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CDATASection"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
-
- tmpl->Inherit(V8Text::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Text::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
index 459cf96..74c80ea 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
@@ -4,102 +4,102 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
-v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getData().c_str());
-}
+ return v8::String::New(privData->nativeObj->getData().c_str());
+ }
-void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(value);
- privData->nativeObj->setData(*localData);
-}
+ void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->nativeObj->setData(*localData);
+ }
-v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in substringData");
+ return v8::Integer::New(privData->nativeObj->getLength());
+ }
+ v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in substringData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
+ std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in appendData");
+ v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localArg(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localArg(args[0]);
- privData->nativeObj->appendData(*localArg);
+ privData->nativeObj->appendData(*localArg);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in insertData");
+ v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[1]);
- privData->nativeObj->insertData(localOffset, *localArg);
+ privData->nativeObj->insertData(localOffset, *localArg);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in deleteData");
+ v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in deleteData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- privData->nativeObj->deleteData(localOffset, localCount);
+ privData->nativeObj->deleteData(localOffset, localCount);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in replaceData");
+ v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in replaceData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[2]);
- privData->nativeObj->replaceData(localOffset, localCount, *localArg);
+ privData->nativeObj->replaceData(localOffset, localCount, *localArg);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
index 6c51ca7..fe93896 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
@@ -33,59 +33,59 @@ namespace DOM {
class V8CharacterData {
public:
- struct V8CharacterDataPrivate {
- V8DOM* dom;
- Arabica::DOM::CharacterData<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8CharacterDataPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("CharacterData"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("substringData"),
- v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendData"),
- v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("insertData"),
- v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("deleteData"),
- v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceData"),
- v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8CharacterDataPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CharacterData<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8CharacterDataPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CharacterData"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("substringData"),
+ v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendData"),
+ v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("insertData"),
+ v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("deleteData"),
+ v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceData"),
+ v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
index f754ea7..e470a70 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
-bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
index 074da74..c659150 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8Comment {
public:
- struct V8CommentPrivate {
- V8DOM* dom;
- Arabica::DOM::Comment<std::string>* nativeObj;
- };
+ struct V8CommentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Comment<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8CommentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8CommentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Comment"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Comment"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
-
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
index f7a7575..0f81958 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
@@ -5,77 +5,77 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
-v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in hasFeature");
+ v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasFeature");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
- bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
+ bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in createDocumentType");
+ v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocumentType");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localQualifiedName(args[0]);
- v8::String::AsciiValue localPublicId(args[1]);
- v8::String::AsciiValue localSystemId(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localQualifiedName(args[0]);
+ v8::String::AsciiValue localPublicId(args[1]);
+ v8::String::AsciiValue localSystemId(args[2]);
- Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
- v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
+ v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in createDocument");
- if (!(V8DocumentType::hasInstance(args[2])))
- throw V8Exception("Parameter mismatch while calling createDocument");
+ v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocument");
+ if (!(V8DocumentType::hasInstance(args[2])))
+ throw V8Exception("Parameter mismatch while calling createDocument");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
- v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
+ v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Document::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Document::jsDestructor);
+ return retObj;
-}
+ }
-bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
index 5c58e22..6fb8c7e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
@@ -32,45 +32,45 @@ namespace DOM {
class V8DOMImplementation {
public:
- struct V8DOMImplementationPrivate {
- V8DOM* dom;
- Arabica::DOM::DOMImplementation<std::string>* nativeObj;
- };
+ struct V8DOMImplementationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DOMImplementation<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8DOMImplementationPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8DOMImplementationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DOMImplementation"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DOMImplementation"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
+ prototype->Set(v8::String::NewSymbol("hasFeature"),
+ v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentType"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocument"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasFeature"),
- v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentType"),
- v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocument"),
- v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
index 06191ea..d9d123a 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
@@ -15,397 +15,397 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
-v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getDoctype()) return v8::Undefined();
- Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
+ if (!privData->nativeObj->getDoctype()) return v8::Undefined();
+ Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
- v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ if (!privData->nativeObj->getImplementation()) return v8::Undefined();
+ Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
- if (!privData->nativeObj->getImplementation()) return v8::Undefined();
- Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
+ return arbaicaRetObj;
- struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-}
+ if (!privData->nativeObj->getDocumentElement()) return v8::Undefined();
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
-v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- if (!privData->nativeObj->getDocumentElement()) return v8::Undefined();
- Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ }
+ v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createElement");
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagName(args[0]);
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-}
-v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createElement");
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTagName(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
-}
+ Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
+ v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
+ struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
- v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
+ return retObj;
- struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createTextNode");
- retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
-}
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createTextNode");
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData));
- v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createComment");
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
-}
+ Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData));
+ v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createComment");
+ struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData));
- v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Comment::jsDestructor);
+ return retObj;
- struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createCDATASection");
- retObj.MakeWeak(0, V8Comment::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
-}
+ Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
+ v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createCDATASection");
+ struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
- v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8CDATASection::jsDestructor);
+ return retObj;
- struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createProcessingInstruction");
- retObj.MakeWeak(0, V8CDATASection::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTarget(args[0]);
+ v8::String::AsciiValue localData(args[1]);
-}
+ Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData));
+ v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createProcessingInstruction");
+ struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTarget(args[0]);
- v8::String::AsciiValue localData(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData));
- v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
+ return retObj;
- struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createAttribute");
- retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
-}
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createAttribute");
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createEntityReference");
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
-}
+ Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName));
+ v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createEntityReference");
+ struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName));
- v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8EntityReference::jsDestructor);
+ return retObj;
- struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
- retObj.MakeWeak(0, V8EntityReference::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagname(args[0]);
-}
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementsByTagName");
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTagname(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in importNode");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling importNode");
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ bool localDeep = args[1]->ToBoolean()->BooleanValue();
-}
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in importNode");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling importNode");
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- bool localDeep = args[1]->ToBoolean()->BooleanValue();
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createElementNS");
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
-}
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createElementNS");
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createAttributeNS");
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
-}
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createAttributeNS");
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
-}
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementById");
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localElementId(args[0]);
-}
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementById");
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localElementId(args[0]);
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ }
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
-
-}
-
-bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
index 2db4b54..c12e0dc 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
@@ -33,91 +33,91 @@ namespace DOM {
class V8Document {
public:
- struct V8DocumentPrivate {
- V8DOM* dom;
- Arabica::DOM::Document<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DocumentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Document"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("createElement"),
- v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
- v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createTextNode"),
- v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createComment"),
- v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createCDATASection"),
- v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
- v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttribute"),
- v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEntityReference"),
- v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("importNode"),
- v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createElementNS"),
- v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttributeNS"),
- v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementById"),
- v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("evaluate"),
- v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8DocumentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Document<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8DocumentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Document"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("createElement"),
+ v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
+ v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createTextNode"),
+ v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createComment"),
+ v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createCDATASection"),
+ v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
+ v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttribute"),
+ v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createEntityReference"),
+ v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("importNode"),
+ v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createElementNS"),
+ v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttributeNS"),
+ v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementById"),
+ v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("evaluate"),
+ v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
index 1403574..e6bec84 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
-bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
index c669b05..cf7f6ba 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8DocumentFragment {
public:
- struct V8DocumentFragmentPrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentFragment<std::string>* nativeObj;
- };
+ struct V8DocumentFragmentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentFragment<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8DocumentFragmentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8DocumentFragmentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DocumentFragment"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentFragment"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
index 6b9a7b0..a2098f2 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
@@ -5,79 +5,79 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
-v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getName().c_str());
-}
+ return v8::String::New(privData->nativeObj->getName().c_str());
+ }
-v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-}
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
-v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-}
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+ }
-v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getInternalSubset().c_str());
+ }
+ bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
-}
-
-v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-
- return v8::String::New(privData->nativeObj->getInternalSubset().c_str());
-}
-bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
index 59c2607..65ce30c 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
@@ -33,55 +33,55 @@ namespace DOM {
class V8DocumentType {
public:
- struct V8DocumentTypePrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentType<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DocumentTypePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DocumentType"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8DocumentTypePrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentType<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8DocumentTypePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentType"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
index 680dd5e..d476daa 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
@@ -6,297 +6,297 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
-v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getTagName().c_str());
-}
-v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getAttribute");
+ return v8::String::New(privData->nativeObj->getTagName().c_str());
+ }
+ v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- std::string retVal = privData->nativeObj->getAttribute(*localName);
+ std::string retVal = privData->nativeObj->getAttribute(*localName);
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in setAttribute");
+ v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in setAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
- v8::String::AsciiValue localValue(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+ v8::String::AsciiValue localValue(args[1]);
- privData->nativeObj->setAttribute(*localName, *localValue);
+ privData->nativeObj->setAttribute(*localName, *localValue);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeAttribute");
+ v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- privData->nativeObj->removeAttribute(*localName);
+ privData->nativeObj->removeAttribute(*localName);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getAttributeNode");
+ v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setAttributeNode");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setAttributeNode");
+ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeAttributeNode");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling removeAttributeNode");
+ v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementsByTagName");
+ v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getAttributeNS");
+ v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
+ std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in setAttributeNS");
+ v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in setAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- v8::String::AsciiValue localValue(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ v8::String::AsciiValue localValue(args[2]);
- privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
+ privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in removeAttributeNS");
+ v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
+ privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
+ v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
+ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+ v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in hasAttribute");
+ v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in hasAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- bool retVal = privData->nativeObj->hasAttribute(*localName);
+ bool retVal = privData->nativeObj->hasAttribute(*localName);
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in hasAttributeNS");
+ v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
+ bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
index e5a52bf..499ae0e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
@@ -33,85 +33,85 @@ namespace DOM {
class V8Element {
public:
- struct V8ElementPrivate {
- V8DOM* dom;
- Arabica::DOM::Element<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8ElementPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Element"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getAttribute"),
- v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttribute"),
- v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttribute"),
- v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNode"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNode"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttribute"),
- v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
- v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8ElementPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Element<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8ElementPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Element"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getAttribute"),
+ v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttribute"),
+ v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttribute"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttribute"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
index f3ce21d..6db7b15 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
@@ -4,32 +4,32 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
-v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+ }
-v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+ }
-v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNotationName().c_str());
-}
-bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ return v8::String::New(privData->nativeObj->getNotationName().c_str());
+ }
+ bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
index 6e85585..acea6ea 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
@@ -33,46 +33,46 @@ namespace DOM {
class V8Entity {
public:
- struct V8EntityPrivate {
- V8DOM* dom;
- Arabica::DOM::Entity<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8EntityPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Entity"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8EntityPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Entity<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8EntityPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Entity"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
index 197fadd..95ceee8 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
-bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
index 86dd61b..9bfb86d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8EntityReference {
public:
- struct V8EntityReferencePrivate {
- V8DOM* dom;
- Arabica::DOM::EntityReference<std::string>* nativeObj;
- };
+ struct V8EntityReferencePrivate {
+ V8DOM* dom;
+ Arabica::DOM::EntityReference<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8EntityReferencePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8EntityReferencePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("EntityReference"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("EntityReference"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
index 037d651..e09bbb8 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
@@ -4,185 +4,185 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
-v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getNamedItem");
+ return v8::Integer::New(privData->nativeObj->getLength());
+ }
+ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setNamedItem");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setNamedItem");
+ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItem");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeNamedItem");
+ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in item");
+ v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getNamedItemNS");
+ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setNamedItemNS");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setNamedItemNS");
+ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItemNS");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in removeNamedItemNS");
+ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
index be89037..a98c5ee 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
@@ -32,60 +32,60 @@ namespace DOM {
class V8NamedNodeMap {
public:
- struct V8NamedNodeMapPrivate {
- V8DOM* dom;
- Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NamedNodeMapPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NamedNodeMap"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("item"),
- v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NamedNodeMapPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NamedNodeMapPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NamedNodeMap"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
index b77f38e..31f6457 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
@@ -1,401 +1,380 @@
#include "V8Document.h"
-#include "V8NamedNodeMap.h"
#include "V8Node.h"
#include "V8NodeList.h"
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
-v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNodeName().c_str());
-}
+ return v8::String::New(privData->nativeObj->getNodeName().c_str());
+ }
-v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNodeValue().c_str());
-}
+ return v8::String::New(privData->nativeObj->getNodeValue().c_str());
+ }
-void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNodeValue(value);
- privData->nativeObj->setNodeValue(*localNodeValue);
-}
+ void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNodeValue(value);
+ privData->nativeObj->setNodeValue(*localNodeValue);
+ }
-v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getNodeType());
-}
+ return v8::Integer::New(privData->nativeObj->getNodeType());
+ }
-v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getParentNode()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
+ if (!privData->nativeObj->getParentNode()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ }
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
- return arbaicaRetObj;
+ if (!privData->nativeObj->getFirstChild()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
-}
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- if (!privData->nativeObj->getFirstChild()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ if (!privData->nativeObj->getLastChild()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-}
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
-v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getLastChild()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
+ if (!privData->nativeObj->getNextSibling()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ }
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
+ Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
-}
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
+ return arbaicaRetObj;
- if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ return v8::String::New(privData->nativeObj->getNamespaceURI().c_str());
+ }
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-}
+ return v8::String::New(privData->nativeObj->getPrefix().c_str());
+ }
-v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localPrefix(value);
+ privData->nativeObj->setPrefix(*localPrefix);
+ }
- if (!privData->nativeObj->getNextSibling()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
+ v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ return v8::String::New(privData->nativeObj->getLocalName().c_str());
+ }
+ v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertBefore");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling insertBefore");
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-}
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
-v8::Handle<v8::Value> V8Node::attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
+ }
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in replaceChild");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling replaceChild");
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-}
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
-v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
- Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ }
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeChild");
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
- return arbaicaRetObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
-}
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- return v8::String::New(privData->nativeObj->getNamespaceURI().c_str());
-}
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- return v8::String::New(privData->nativeObj->getPrefix().c_str());
-}
+ }
-void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localPrefix(value);
- privData->nativeObj->setPrefix(*localPrefix);
-}
+ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling appendChild");
-v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- return v8::String::New(privData->nativeObj->getLocalName().c_str());
-}
-v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in insertBefore");
- if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
- throw V8Exception("Parameter mismatch while calling insertBefore");
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ }
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
-}
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in replaceChild");
- if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
- throw V8Exception("Parameter mismatch while calling replaceChild");
+ bool retVal = privData->nativeObj->hasChildNodes();
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
+ return v8::Boolean::New(retVal);
+ }
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in cloneNode");
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ bool localDeep = args[0]->ToBoolean()->BooleanValue();
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
-}
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeChild");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling removeChild");
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ }
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ privData->nativeObj->normalize();
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ return v8::Undefined();
+ }
-}
+ v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in isSupported");
-v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in appendChild");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling appendChild");
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ return v8::Boolean::New(retVal);
+ }
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ bool retVal = privData->nativeObj->hasAttributes();
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
+ bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-
- bool retVal = privData->nativeObj->hasChildNodes();
-
- return v8::Boolean::New(retVal);
-}
-
-v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in cloneNode");
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- bool localDeep = args[0]->ToBoolean()->BooleanValue();
-
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
-
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
-
-}
-
-v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-
- privData->nativeObj->normalize();
-
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in isSupported");
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
-
- bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
-
- return v8::Boolean::New(retVal);
-}
-
-v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-
- bool retVal = privData->nativeObj->hasAttributes();
-
- return v8::Boolean::New(retVal);
-}
-
-bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
index bb6bbd2..6bb90f9 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
@@ -32,131 +32,131 @@ namespace DOM {
class V8Node {
public:
- struct V8NodePrivate {
- V8DOM* dom;
- Arabica::DOM::Node<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Node"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("insertBefore"),
- v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceChild"),
- v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeChild"),
- v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendChild"),
- v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasChildNodes"),
- v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("cloneNode"),
- v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("normalize"),
- v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isSupported"),
- v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributes"),
- v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NodePrivate {
+ V8DOM* dom;
+ Arabica::DOM::Node<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NodePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> attributesCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Node"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("insertBefore"),
+ v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceChild"),
+ v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeChild"),
+ v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendChild"),
+ v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasChildNodes"),
+ v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("cloneNode"),
+ v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("normalize"),
+ v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("isSupported"),
+ v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributes"),
+ v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp
new file mode 100644
index 0000000..09f9e1d
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeCustom.cpp
@@ -0,0 +1,31 @@
+#include "V8Node.h"
+#include "V8NamedNodeMap.h"
+
+namespace Arabica {
+namespace DOM {
+
+v8::Handle<v8::Value> V8Node::attributesCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ if (!privData->nativeObj->hasAttributes()) {
+ return v8::Undefined();
+ }
+
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
+
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
index bee706e..bc2afb5 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
@@ -4,41 +4,41 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
-v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
-}
-v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in item");
+ return v8::Integer::New(privData->nativeObj->getLength());
+ }
+ v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
-}
+ }
-bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
index c454e65..8a07998 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
@@ -32,44 +32,44 @@ namespace DOM {
class V8NodeList {
public:
- struct V8NodeListPrivate {
- V8DOM* dom;
- Arabica::DOM::NodeList<std::string>* nativeObj;
- };
+ struct V8NodeListPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NodeList<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8NodeListPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8NodeListPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeList"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeList"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetIndexedPropertyHandler(V8NodeList::indexedPropertyCustomGetter, 0);
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- instance->SetIndexedPropertyHandler(V8NodeList::indexedPropertyCustomGetter, 0);
- prototype->Set(v8::String::NewSymbol("item"),
- v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
index fade729..6f59a90 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
@@ -3,35 +3,35 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
-v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->size());
-}
+ return v8::Integer::New(privData->nativeObj->size());
+ }
-v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->empty());
-}
-v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(privData->nativeObj->empty());
+ }
+ v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- privData->nativeObj->to_document_order();
+ privData->nativeObj->to_document_order();
- return v8::Undefined();
-}
+ return v8::Undefined();
+ }
-bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
index 97b5d4f..78e4410 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
@@ -32,47 +32,47 @@ namespace DOM {
class V8NodeSet {
public:
- struct V8NodeSetPrivate {
- V8DOM* dom;
- Arabica::XPath::NodeSet<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodeSetPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeSet"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
- prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
- v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NodeSetPrivate {
+ V8DOM* dom;
+ Arabica::XPath::NodeSet<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NodeSetPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeSet"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
+ prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
+ v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
index 129563d..5ecdd10 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
@@ -4,25 +4,25 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
-v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
-}
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+ }
-v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
-}
-bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+ }
+ bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
index 0745728..2102a24 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
@@ -33,43 +33,43 @@ namespace DOM {
class V8Notation {
public:
- struct V8NotationPrivate {
- V8DOM* dom;
- Arabica::DOM::Notation<std::string>* nativeObj;
- };
+ struct V8NotationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Notation<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8NotationPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8NotationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Notation"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Notation"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
index c6d2b28..f28a56d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
@@ -4,32 +4,32 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
-v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getTarget().c_str());
-}
+ return v8::String::New(privData->nativeObj->getTarget().c_str());
+ }
-v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getData().c_str());
-}
+ return v8::String::New(privData->nativeObj->getData().c_str());
+ }
-void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(value);
- privData->nativeObj->setData(*localData);
-}
-bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->nativeObj->setData(*localData);
+ }
+ bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
index 56b61eb..a588b1f 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
@@ -33,44 +33,44 @@ namespace DOM {
class V8ProcessingInstruction {
public:
- struct V8ProcessingInstructionPrivate {
- V8DOM* dom;
- Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
- };
+ struct V8ProcessingInstructionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
+ instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
index 9679d74..54006d5 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
@@ -4,74 +4,74 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
-v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->name.c_str());
-}
+ return v8::String::New(privData->nativeObj->name.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (privData->nativeObj->origin.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->origin.c_str());
-}
+ if (privData->nativeObj->origin.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->origin.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (privData->nativeObj->origintype.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->origintype.c_str());
-}
+ if (privData->nativeObj->origintype.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->origintype.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (privData->nativeObj->raw.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->raw.c_str());
-}
+ if (privData->nativeObj->raw.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->raw.c_str());
+ }
-v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->dom) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
+ if (!privData->nativeObj->dom) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ }
-}
+ v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+ if (privData->nativeObj->invokeid.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->invokeid.c_str());
+ }
+ bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
- if (privData->nativeObj->invokeid.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->invokeid.c_str());
-}
-bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
-
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
index 670d818..992b83e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
@@ -32,66 +32,66 @@ namespace DOM {
class V8SCXMLEvent {
public:
- struct V8SCXMLEventPrivate {
- V8DOM* dom;
- uscxml::Event* nativeObj;
- };
-
- V8_DESTRUCTOR(V8SCXMLEventPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> sendidCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("SCXMLEvent"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("raw"), V8SCXMLEvent::rawAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
- tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8SCXMLEventPrivate {
+ V8DOM* dom;
+ uscxml::Event* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8SCXMLEventPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> sendidCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("SCXMLEvent"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("raw"), V8SCXMLEvent::rawAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+ tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
index 42b298a..fb027d5 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
@@ -4,34 +4,34 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
-v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in splitText");
+ v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in splitText");
- v8::Local<v8::Object> self = args.Holder();
- struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
- v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
-}
+ }
-bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
index 61b92fb..bbf2577 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
@@ -33,40 +33,40 @@ namespace DOM {
class V8Text {
public:
- struct V8TextPrivate {
- V8DOM* dom;
- Arabica::DOM::Text<std::string>* nativeObj;
- };
+ struct V8TextPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Text<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8TextPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8TextPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Text"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Text"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
- instance->SetInternalFieldCount(1);
+ prototype->Set(v8::String::NewSymbol("splitText"),
+ v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("splitText"),
- v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
index 968e53d..38f69ae 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
@@ -4,82 +4,82 @@
namespace Arabica {
namespace DOM {
-v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
+ v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
-v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::Number::New(privData->nativeObj->asNumber());
-}
+ return v8::Number::New(privData->nativeObj->asNumber());
+ }
-v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->asString().c_str());
-}
+ return v8::String::New(privData->nativeObj->asString().c_str());
+ }
-v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->asBool());
-}
-v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(privData->nativeObj->asBool());
+ }
+ v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
- v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
+ v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeSet::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeSet::jsDestructor);
+ return retObj;
-}
+ }
-v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
+ v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- bool retVal = privData->nativeObj->asBool();
+ bool retVal = privData->nativeObj->asBool();
- return v8::Boolean::New(retVal);
-}
+ return v8::Boolean::New(retVal);
+ }
-v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
+ v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- std::string retVal = privData->nativeObj->asString();
+ std::string retVal = privData->nativeObj->asString();
- return v8::String::New(retVal.c_str());
-}
+ return v8::String::New(retVal.c_str());
+ }
-v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
+ v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- double retVal = privData->nativeObj->asNumber();
+ double retVal = privData->nativeObj->asNumber();
- return v8::Number::New(retVal);
-}
+ return v8::Number::New(retVal);
+ }
-bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
-}
+ bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
index f6a2d10..1fae618 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
@@ -32,60 +32,60 @@ namespace DOM {
class V8XPathResult {
public:
- struct V8XPathResultPrivate {
- V8DOM* dom;
- Arabica::XPath::XPathValue<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8XPathResultPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("XPathResult"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("asNodeSet"),
- v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asBool"),
- v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asString"),
- v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNumber"),
- v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8XPathResultPrivate {
+ V8DOM* dom;
+ Arabica::XPath::XPathValue<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8XPathResultPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("XPathResult"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("asNodeSet"),
+ v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asBool"),
+ v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asString"),
+ v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asNumber"),
+ v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/element/CMakeLists.txt b/src/uscxml/plugins/element/CMakeLists.txt
index 0c9cbda..6697962 100644
--- a/src/uscxml/plugins/element/CMakeLists.txt
+++ b/src/uscxml/plugins/element/CMakeLists.txt
@@ -15,6 +15,23 @@ else()
list (APPEND USCXML_FILES ${FETCH_ELEMENT})
endif()
+# MMI elements
+
+# file(GLOB_RECURSE MMI_ELEMENT
+# mmi/*.cpp
+# mmi/*.h
+# )
+# source_group("Element\\mmi" FILES ${MMI_ELEMENT})
+# if (BUILD_AS_PLUGINS)
+# add_library(
+# element_mmi SHARED
+# ${MMI_ELEMENT})
+# target_link_libraries(element_mmi uscxml)
+# set_target_properties(element_mmi PROPERTIES FOLDER "Plugin Element")
+# else()
+# list (APPEND USCXML_FILES ${MMI_ELEMENT})
+# endif()
+
# Postpone element
diff --git a/src/uscxml/plugins/element/fetch/FetchElement.cpp b/src/uscxml/plugins/element/fetch/FetchElement.cpp
index e6ceb3f..f2f18fc 100644
--- a/src/uscxml/plugins/element/fetch/FetchElement.cpp
+++ b/src/uscxml/plugins/element/fetch/FetchElement.cpp
@@ -19,9 +19,9 @@ bool connect(pluma::Host& host) {
#endif
boost::shared_ptr<ExecutableContentImpl> FetchElement::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<FetchElement> invoker = boost::shared_ptr<FetchElement>(new FetchElement());
- invoker->_interpreter = interpreter;
- return invoker;
+ boost::shared_ptr<FetchElement> element = boost::shared_ptr<FetchElement>(new FetchElement());
+ element->_interpreter = interpreter;
+ return element;
}
FetchElement::~FetchElement() {
diff --git a/src/uscxml/plugins/element/mmi/MMIEvents.cpp b/src/uscxml/plugins/element/mmi/MMIEvents.cpp
new file mode 100644
index 0000000..5d688ff
--- /dev/null
+++ b/src/uscxml/plugins/element/mmi/MMIEvents.cpp
@@ -0,0 +1,42 @@
+#include "MMIEvents.h"
+
+namespace uscxml {
+
+ void PrepareRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void StartRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void PauseRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void ResumeRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void CancelRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void ClearContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void StatusRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void NewContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void PrepareResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void StartResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void PauseResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void ResumeResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void CancelResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void ClearContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void StatusResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void DoneNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void NewContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+ void ExtensionNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+ }
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/mmi/MMIEvents.h b/src/uscxml/plugins/element/mmi/MMIEvents.h
new file mode 100644
index 0000000..3a31f2a
--- /dev/null
+++ b/src/uscxml/plugins/element/mmi/MMIEvents.h
@@ -0,0 +1,58 @@
+#ifndef MMIEVENTS_H_QHO6VT3M
+#define MMIEVENTS_H_QHO6VT3M
+
+#include <uscxml/Interpreter.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+#define ELEMENT_CREATOR(elementName) \
+boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter) { \
+ boost::shared_ptr<elementName> element = boost::shared_ptr<elementName>(new elementName()); \
+ element->_interpreter = interpreter; \
+ return element; \
+}
+
+#define ELEMENT_MMI_CLASS(elementName) \
+class elementName##Element : public ExecutableContentImpl { \
+public:\
+ elementName##Element () {}\
+ virtual ~elementName##Element () {}\
+ ELEMENT_CREATOR(elementName##Element);\
+ std::string getLocalName() { return "elementName"; }\
+ std::string getNamespace() { return "http://www.w3.org/2008/04/mmi-arch"; }\
+ bool processChildren() { return false; }\
+ void enterElement(const Arabica::DOM::Node<std::string>& node);\
+ void exitElement(const Arabica::DOM::Node<std::string>& node) {}\
+};
+
+namespace uscxml {
+
+ELEMENT_MMI_CLASS(PrepareRequest);
+ELEMENT_MMI_CLASS(StartRequest);
+ELEMENT_MMI_CLASS(PauseRequest);
+ELEMENT_MMI_CLASS(ResumeRequest);
+ELEMENT_MMI_CLASS(CancelRequest);
+ELEMENT_MMI_CLASS(ClearContextRequest);
+ELEMENT_MMI_CLASS(StatusRequest);
+ELEMENT_MMI_CLASS(NewContextResponse);
+ELEMENT_MMI_CLASS(PrepareResponse);
+ELEMENT_MMI_CLASS(StartResponse);
+ELEMENT_MMI_CLASS(PauseResponse);
+ELEMENT_MMI_CLASS(ResumeResponse);
+ELEMENT_MMI_CLASS(CancelResponse);
+ELEMENT_MMI_CLASS(ClearContextResponse);
+ELEMENT_MMI_CLASS(StatusResponse);
+ELEMENT_MMI_CLASS(DoneNotification);
+ELEMENT_MMI_CLASS(NewContextRequest);
+ELEMENT_MMI_CLASS(ExtensionNotification);
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(FetchElement, ExecutableContentImpl);
+#endif
+
+}
+
+
+#endif /* end of include guard: MMIEVENTS_H_QHO6VT3M */
diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
index aaf6bc4..c04c90d 100644
--- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
+++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
@@ -24,7 +24,7 @@ FFMPEGInvoker::FFMPEGInvoker() {
FFMPEGInvoker::~FFMPEGInvoker() {
};
-boost::shared_ptr<IOProcessorImpl> FFMPEGInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> FFMPEGInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<FFMPEGInvoker> invoker = boost::shared_ptr<FFMPEGInvoker>(new FFMPEGInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
index 972c4ff..c29a173 100644
--- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
+++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h
@@ -13,7 +13,7 @@ class FFMPEGInvoker : public InvokerImpl {
public:
FFMPEGInvoker();
virtual ~FFMPEGInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
index 8e3209a..5900cc8 100644
--- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
+++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp
@@ -37,7 +37,7 @@ DirMonInvoker::~DirMonInvoker() {
_thread->join();
};
-boost::shared_ptr<IOProcessorImpl> DirMonInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> DirMonInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<DirMonInvoker> invoker = boost::shared_ptr<DirMonInvoker>(new DirMonInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
index a58da10..611106b 100644
--- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
+++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h
@@ -56,7 +56,7 @@ class DirMonInvoker : public InvokerImpl, public DirectoryWatchMonitor {
public:
DirMonInvoker();
virtual ~DirMonInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp
index 932452e..06141c3 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp
@@ -22,7 +22,7 @@ OSGInvoker::OSGInvoker() {
OSGInvoker::~OSGInvoker() {
};
-boost::shared_ptr<IOProcessorImpl> OSGInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> OSGInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<OSGInvoker> invoker = boost::shared_ptr<OSGInvoker> (new OSGInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
index e79b250..bb46e79 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h
@@ -20,7 +20,7 @@ class OSGInvoker : public InvokerImpl, public Arabica::DOM::Events::EventListene
public:
OSGInvoker();
virtual ~OSGInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp
index de39424..e377e5c 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp
@@ -52,7 +52,7 @@ OSGConverter::~OSGConverter() {
}
};
-boost::shared_ptr<IOProcessorImpl> OSGConverter::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> OSGConverter::create(InterpreterImpl* interpreter) {
boost::shared_ptr<OSGConverter> invoker = boost::shared_ptr<OSGConverter>(new OSGConverter());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
index d3cee30..78d6c6c 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h
@@ -15,7 +15,7 @@ class OSGConverter : public InvokerImpl {
public:
OSGConverter();
virtual ~OSGConverter();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp
index b69f569..c7b91f6 100644
--- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp
+++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp
@@ -22,7 +22,7 @@ HeartbeatInvoker::~HeartbeatInvoker() {
cancel("");
};
-boost::shared_ptr<IOProcessorImpl> HeartbeatInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> HeartbeatInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<HeartbeatInvoker> invoker = boost::shared_ptr<HeartbeatInvoker>(new HeartbeatInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
index 5a6272e..ea83db9 100644
--- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
+++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h
@@ -13,7 +13,7 @@ class HeartbeatInvoker : public InvokerImpl {
public:
HeartbeatInvoker();
virtual ~HeartbeatInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
index 03e62bd..771b159 100644
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
@@ -25,7 +25,7 @@ HTTPServletInvoker::~HTTPServletInvoker() {
};
-boost::shared_ptr<IOProcessorImpl> HTTPServletInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> HTTPServletInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<HTTPServletInvoker> invoker = boost::shared_ptr<HTTPServletInvoker>(new HTTPServletInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
index 06a286c..de9c300 100644
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
@@ -14,7 +14,7 @@ class HTTPServletInvoker : public InvokerImpl, public HTTPServlet {
public:
HTTPServletInvoker();
virtual ~HTTPServletInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
index c552d1f..d61dbfe 100644
--- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
+++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h
@@ -24,7 +24,7 @@ class MilesSessionInvoker : public InvokerImpl {
public:
MilesSessionInvoker();
virtual ~MilesSessionInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
index d226784..4d514ef 100644
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
+++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
@@ -21,7 +21,7 @@ SampleInvoker::SampleInvoker() {
SampleInvoker::~SampleInvoker() {
};
-boost::shared_ptr<IOProcessorImpl> SampleInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> SampleInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<SampleInvoker> invoker = boost::shared_ptr<SampleInvoker>(new SampleInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
index 9261f2e..30297b2 100644
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h
+++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
@@ -13,7 +13,7 @@ class SampleInvoker : public InvokerImpl {
public:
SampleInvoker();
virtual ~SampleInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
index 9eafbcf..c697993 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
@@ -23,7 +23,7 @@ USCXMLInvoker::~USCXMLInvoker() {
_cancelled = true;
};
-boost::shared_ptr<IOProcessorImpl> USCXMLInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> USCXMLInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<USCXMLInvoker> invoker = boost::shared_ptr<USCXMLInvoker>(new USCXMLInvoker());
invoker->_parentInterpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
index 4b2c2d5..896eaa3 100644
--- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
+++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h
@@ -20,7 +20,7 @@ class USCXMLInvoker :
public:
USCXMLInvoker();
virtual ~USCXMLInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
names.insert("scxml");
diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp
index 1d563ec..db65ab8 100644
--- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp
+++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp
@@ -21,7 +21,7 @@ Sqlite3Invoker::Sqlite3Invoker() {
Sqlite3Invoker::~Sqlite3Invoker() {
};
-boost::shared_ptr<IOProcessorImpl> Sqlite3Invoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> Sqlite3Invoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<Sqlite3Invoker> invoker = boost::shared_ptr<Sqlite3Invoker>(new Sqlite3Invoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
index 35bfec4..b3a9fd7 100644
--- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
+++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h
@@ -13,7 +13,7 @@ class Sqlite3Invoker : public InvokerImpl {
public:
Sqlite3Invoker();
virtual ~Sqlite3Invoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp
index 468628c..d306cb9 100644
--- a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp
+++ b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp
@@ -21,7 +21,7 @@ SystemInvoker::SystemInvoker() {
SystemInvoker::~SystemInvoker() {
};
-boost::shared_ptr<IOProcessorImpl> SystemInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> SystemInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<SystemInvoker> invoker = boost::shared_ptr<SystemInvoker>(new SystemInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.h b/src/uscxml/plugins/invoker/system/SystemInvoker.h
index 0292d41..78903f6 100644
--- a/src/uscxml/plugins/invoker/system/SystemInvoker.h
+++ b/src/uscxml/plugins/invoker/system/SystemInvoker.h
@@ -13,7 +13,7 @@ class SystemInvoker : public InvokerImpl {
public:
SystemInvoker();
virtual ~SystemInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
index 5439413..641d713 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
@@ -28,7 +28,7 @@ UmundoInvoker::~UmundoInvoker() {
}
};
-boost::shared_ptr<IOProcessorImpl> UmundoInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> UmundoInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<UmundoInvoker> invoker = boost::shared_ptr<UmundoInvoker>(new UmundoInvoker());
invoker->_interpreter = interpreter;
return invoker;
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
index db944cd..f917819 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
@@ -20,7 +20,7 @@ class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public u
public:
UmundoInvoker();
virtual ~UmundoInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
index e7d1440..6e0b2af 100644
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
@@ -21,7 +21,7 @@ VoiceXMLInvoker::VoiceXMLInvoker() {
VoiceXMLInvoker::~VoiceXMLInvoker() {
};
-boost::shared_ptr<IOProcessorImpl> VoiceXMLInvoker::create(InterpreterImpl* interpreter) {
+boost::shared_ptr<InvokerImpl> VoiceXMLInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<VoiceXMLInvoker> invoker = boost::shared_ptr<VoiceXMLInvoker>(new VoiceXMLInvoker());
invoker->_interpreter = interpreter;
invoker->_pub = umundo::TypedPublisher("mmi:jvoicexml");
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
index 450af5d..ca5f557 100644
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
+++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
@@ -2,7 +2,7 @@
#define VOICEXMLINVOKER_H_W09J90F0
#include <uscxml/Interpreter.h>
-#include <uscxml/plugins/ioprocessor/modality/MMIComponent.h>
+#include <uscxml/plugins/ioprocessor/modality/MMIMessages.h>
#include <uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h>
#include <umundo/core.h>
@@ -18,7 +18,7 @@ class VoiceXMLInvoker : public InvokerImpl, public umundo::TypedReceiver {
public:
VoiceXMLInvoker();
virtual ~VoiceXMLInvoker();
- virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp
deleted file mode 100644
index c1e973b..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "MMIComponent.h"
-//#include <glog/logging.h>
-
-namespace uscxml {
-
-MMIComponent::MMIComponent() {
-}
-
-MMIComponent::~MMIComponent() {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h
deleted file mode 100644
index 990222f..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef MMIIOPROCESSOR_H_W09J90F0
-#define MMIIOPROCESSOR_H_W09J90F0
-
-#include "MMIMessages.h"
-
-namespace uscxml {
-
-class MMIComponent {
-public:
- MMIComponent();
- virtual ~MMIComponent();
-
- /** Modality component */
- virtual PrepareResponse prepare(const PrepareRequest&) = 0;
- virtual StartResponse start(const StartRequest&) = 0;
- virtual CancelResponse cancel(const CancelRequest&) = 0;
- virtual PauseResponse pause(const PauseRequest&) = 0;
- virtual ResumeResponse resume(const ResumeRequest&) = 0;
- virtual ExtensionNotification extension(const ExtensionNotification&) = 0;
- virtual ClearContextRequest clearContext(const ClearContextRequest&) = 0;
- virtual StatusResponse status(const StatusRequest&) = 0;
-
- /** Interaction Manager */
- virtual NewContextResponse newContext(const NewContextRequest&) = 0;
- virtual DoneNotification done(const DoneNotification&) = 0;
-// virtual ExtensionNotification extension(const ExtensionNotification&);
-
-
-};
-
-}
-
-
-#endif /* end of include guard: MMIIOPROCESSOR_H_W09J90F0 */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
new file mode 100644
index 0000000..4734ff5
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
@@ -0,0 +1,188 @@
+#include "uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h"
+#include "uscxml/Message.h"
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool connect(pluma::Host& host) {
+ host.add( new MMIHTTPIOProcessorProvider() );
+ return true;
+}
+#endif
+
+MMIHTTPIOProcessor::MMIHTTPIOProcessor() {
+}
+
+MMIHTTPIOProcessor::~MMIHTTPIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> MMIHTTPIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<MMIHTTPIOProcessor> io = boost::shared_ptr<MMIHTTPIOProcessor>(new MMIHTTPIOProcessor());
+ io->_interpreter = interpreter;
+
+ // register at http server
+ std::string path = interpreter->getName();
+ int i = 2;
+ while (!HTTPServer::registerServlet(path + "/mmihttp", io.get())) {
+ std::stringstream ss;
+ ss << interpreter->getName() << i++;
+ path = ss.str();
+ }
+
+ return io;
+}
+
+void MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+ Event reqEvent = req;
+ reqEvent.type = Event::EXTERNAL;
+ bool scxmlStructFound = false;
+
+ if (reqEvent.data.compound["header"].compound.find("Content-Type") != reqEvent.data.compound["header"].compound.end() &&
+ boost::iequals(reqEvent.data.compound["header"].compound["Content-Type"].atom, "application/x-www-form-urlencoded")) {
+ std::stringstream ss(reqEvent.data.compound["content"].atom);
+ std::string term;
+ while(std::getline(ss, term, '&')) {
+ size_t split = term.find_first_of("=");
+ if (split != std::string::npos) {
+ std::string key = evhttp_decode_uri(term.substr(0, split).c_str());
+ std::string value = evhttp_decode_uri(term.substr(split + 1).c_str());
+ if (boost::iequals(key, "_scxmleventname")) {
+ reqEvent.name = value;
+ } else if (boost::iequals(key, "content")) {
+ reqEvent.initContent(value);
+ } else {
+ reqEvent.data.compound[key] = value;
+ reqEvent.params.insert(std::make_pair(key, value));
+ }
+ } else {
+ // this is most likely wrong
+ reqEvent.content = evhttp_decode_uri(term.c_str());
+ }
+ }
+ } else {
+ if (reqEvent.data.compound["header"].compound.find("_scxmleventstruct") != reqEvent.data.compound["header"].compound.end()) {
+ // TODO: this looses all other information
+ reqEvent = Event::fromXML(evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventstruct"].atom.c_str()));
+ scxmlStructFound = true;
+ }
+ if (reqEvent.data.compound["header"].compound.find("_scxmleventname") != reqEvent.data.compound["header"].compound.end()) {
+ reqEvent.name = evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventname"].atom.c_str());
+ }
+ }
+ std::map<std::string, Data>::iterator headerIter = reqEvent.data.compound["header"].compound.begin();
+ while(headerIter != reqEvent.data.compound["header"].compound.end()) {
+ reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.atom.c_str()), Data::VERBATIM);
+ headerIter++;
+ }
+
+#if 0
+ std::map<std::string, std::string>::const_iterator headerIter = req.headers.begin();
+ while(headerIter != req.headers.end()) {
+ if (boost::iequals("_scxmleventstruct", headerIter->first)) {
+ reqEvent = Event::fromXML(evhttp_decode_uri(headerIter->second.c_str()));
+ scxmlStructFound = true;
+ break;
+ } else if (boost::iequals("_scxmleventname", headerIter->first)) {
+ reqEvent.name = evhttp_decode_uri(headerIter->second.c_str());
+ } else {
+ reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.c_str()), Data::VERBATIM);
+ }
+ headerIter++;
+ }
+#endif
+
+ /// test532
+ if (reqEvent.name.length() == 0)
+ reqEvent.name = "http." + req.data.compound.at("type").atom;
+
+ if (!scxmlStructFound) {
+ // get content into event
+ reqEvent.data.compound["content"] = Data(req.content, Data::VERBATIM);
+ }
+
+ returnEvent(reqEvent);
+ evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+}
+
+void MMIHTTPIOProcessor::send(const SendRequest& req) {
+
+ if (req.target.length() == 0) {
+ _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM));
+ return;
+ }
+
+ bool isLocal = false;
+ std::string target;
+ if (!boost::equals(req.target, _url)) {
+ target = req.target;
+ } else {
+ isLocal = true;
+ target = _url;
+ }
+ URL targetURL(target);
+ std::stringstream kvps;
+ std::string kvpSeperator;
+
+ // event name
+ if (req.name.size() > 0) {
+ kvps << kvpSeperator << evhttp_encode_uri("_scxmleventname") << "=" << evhttp_encode_uri(req.name.c_str());
+ kvpSeperator = "&";
+// targetURL.addOutHeader("_scxmleventname", evhttp_encode_uri(req.name.c_str()));
+ }
+
+ // event namelist
+ if (req.namelist.size() > 0) {
+ std::map<std::string, std::string>::const_iterator namelistIter = req.namelist.begin();
+ while (namelistIter != req.namelist.end()) {
+ kvps << kvpSeperator << evhttp_encode_uri(namelistIter->first.c_str()) << "=" << evhttp_encode_uri(namelistIter->second.c_str());
+ kvpSeperator = "&";
+// targetURL.addOutHeader(namelistIter->first, namelistIter->second);
+ namelistIter++;
+ }
+ }
+
+ // event params
+ if (req.params.size() > 0) {
+ std::multimap<std::string, std::string>::const_iterator paramIter = req.params.begin();
+ while (paramIter != req.params.end()) {
+ kvps << kvpSeperator << evhttp_encode_uri(paramIter->first.c_str()) << "=" << evhttp_encode_uri(paramIter->second.c_str());
+ kvpSeperator = "&";
+// targetURL.addOutHeader(paramIter->first, paramIter->second);
+ paramIter++;
+ }
+ }
+
+ // content
+
+ if (req.content.size() > 0) {
+ kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
+ kvpSeperator = "&";
+ }
+ if (req.dom) {
+ std::stringstream xmlStream;
+ xmlStream << req.dom;
+ kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(xmlStream.str().c_str());
+ kvpSeperator = "&";
+ }
+ targetURL.setOutContent(kvps.str());
+
+ targetURL.setRequestType("post");
+ targetURL.addMonitor(this);
+
+ _sendRequests[req.sendid] = std::make_pair(targetURL, req);
+ if (isLocal) {
+ // test201 use a blocking request with local communication
+ targetURL.download(true);
+ } else {
+ URLFetcher::fetchURL(targetURL);
+ }
+}
+
+
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
new file mode 100644
index 0000000..2dbd595
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
@@ -0,0 +1,53 @@
+#ifndef MMIHTTPIOPROCESSOR_H_P1FN0YPL
+#define MMIHTTPIOPROCESSOR_H_P1FN0YPL
+
+#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+#ifndef _WIN32
+#include <sys/time.h>
+#endif
+
+#include <event2/http.h>
+#include <event2/http_struct.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+ class MMIHTTPIOProcessor : public BasicHTTPIOProcessor {
+ public:
+ MMIHTTPIOProcessor();
+ virtual ~MMIHTTPIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("mmihttp");
+ names.insert("http://www.w3.org/TR/mmi-arch/#HTTPTransport");
+ return names;
+ }
+
+ virtual void send(const SendRequest& req);
+
+ /// HTTPServlet
+ void httpRecvRequest(const HTTPServer::Request& req);
+
+ bool canAdaptPath() {
+ return false;
+ }
+
+ protected:
+ std::string _url;
+ std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
+ };
+
+ #ifdef BUILD_AS_PLUGINS
+ PLUMA_INHERIT_PROVIDER(MMIHTTPIOProcessor, IOProcessorImpl);
+ #endif
+
+}
+
+#endif /* end of include guard: MMIHTTPIOPROCESSOR_H_P1FN0YPL */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h b/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h
deleted file mode 100644
index 45e316f..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef MMIINVOKER_H_612CXWUU
-#define MMIINVOKER_H_612CXWUU
-
-#include "MMIComponent.h"
-
-namespace uscxml {
-
-class MMIInvokerImpl : public virtual InvokerImpl, public MMIIOProcessor {
-};
-
-}
-#endif /* end of include guard: MMIINVOKER_H_612CXWUU */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
index 717e174..bf32b9d 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
@@ -5,15 +5,86 @@
#include <DOM/SAX2DOM/SAX2DOM.hpp>
#include <SAX/helpers/InputSourceResolver.hpp>
+#include <uscxml/NameSpacingParser.h>
+
#include <boost/algorithm/string.hpp>
+#define STRING_ATTR_OR_EXPR(element, name)\
+(element.hasAttributeNS(nameSpace, "name##Expr") && interpreter ? \
+ interpreter->getDataModel().evalAsString(element.getAttributeNS(nameSpace, "name##Expr")) : \
+ (element.hasAttributeNS(nameSpace, #name) ? element.getAttributeNS(nameSpace, #name) : "") \
+)
+
+
namespace uscxml {
using namespace Arabica::DOM;
-std::string MMIMessage::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
+std::string MMIEvent::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
+
+ MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) {
+ if (!node)
+ return INVALID;
+
+ if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST"))
+ return NEWCONTEXTREQUEST;
+ if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE"))
+ return NEWCONTEXTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "PREPAREREQUEST"))
+ return PREPAREREQUEST;
+ if (boost::iequals(node.getLocalName(), "PREPARERESPONSE"))
+ return PREPARERESPONSE;
+ if (boost::iequals(node.getLocalName(), "STARTREQUEST"))
+ return STARTREQUEST;
+ if (boost::iequals(node.getLocalName(), "STARTRESPONSE"))
+ return STARTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "DONENOTIFICATION"))
+ return DONENOTIFICATION;
+ if (boost::iequals(node.getLocalName(), "CANCELREQUEST"))
+ return CANCELREQUEST;
+ if (boost::iequals(node.getLocalName(), "CANCELRESPONSE"))
+ return CANCELRESPONSE;
+ if (boost::iequals(node.getLocalName(), "PAUSEREQUEST"))
+ return PAUSEREQUEST;
+ if (boost::iequals(node.getLocalName(), "PAUSERESPONSE"))
+ return PAUSERESPONSE;
+ if (boost::iequals(node.getLocalName(), "RESUMEREQUEST"))
+ return RESUMEREQUEST;
+ if (boost::iequals(node.getLocalName(), "RESUMERESPONSE"))
+ return RESUMERESPONSE;
+ if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION"))
+ return EXTENSIONNOTIFICATION;
+ if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST"))
+ return CLEARCONTEXTREQUEST;
+ if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE"))
+ return CLEARCONTEXTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "STATUSREQUEST"))
+ return STATUSREQUEST;
+ if (boost::iequals(node.getLocalName(), "STATUSRESPONSE"))
+ return STATUSRESPONSE;
+ return INVALID;
+ }
+
+ Arabica::DOM::Node<std::string> MMIEvent::getEventNode(Arabica::DOM::Node<std::string> node) {
+ if (node.getNodeType() == Node_base::DOCUMENT_NODE)
+ node = Arabica::DOM::Document<std::string>(node).getDocumentElement();
+
+ // get the first element
+ while (node && node.getNodeType() != Node_base::ELEMENT_NODE) {
+ node = node.getNextSibling();
+ }
+ // get the contained message
+ if (node && getType(node) == INVALID) {
+ node = node.getFirstChild();
+ while (node && node.getNodeType() != Node_base::ELEMENT_NODE && getType(node) == INVALID) {
+ node = node.getNextSibling();
+ }
+ }
+ return node;
+ }
-Arabica::DOM::Document<std::string> MMIMessage::toXML() {
+
+Arabica::DOM::Document<std::string> MMIEvent::toXML() const {
Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
Document<std::string> doc = domFactory.createDocument(nameSpace, "", 0);
Element<std::string> mmiElem = doc.createElementNS(nameSpace, "mmi");
@@ -23,7 +94,7 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() {
msgElem.setAttributeNS(nameSpace, "RequestID", requestId);
if (data.size() > 0) {
- Element<std::string> dataElem = doc.createElementNS(nameSpace, "data");
+ Element<std::string> dataElem = doc.createElementNS(nameSpace, "Data");
// try to parse content
std::stringstream* ss = new std::stringstream();
@@ -32,7 +103,7 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() {
Arabica::SAX::InputSource<std::string> inputSource;
inputSource.setByteStream(ssPtr);
- Arabica::SAX2DOM::Parser<std::string> parser;
+ NameSpacingParser parser;
if(parser.parse(inputSource)) {
Node<std::string> importedNode = doc.importNode(parser.getDocument().getDocumentElement(), true);
dataElem.appendChild(importedNode);
@@ -45,18 +116,17 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() {
mmiElem.appendChild(msgElem);
doc.appendChild(mmiElem);
- std::cout << doc;
return doc;
}
-Arabica::DOM::Document<std::string> ContextualizedRequest::toXML() {
- Document<std::string> doc = MMIMessage::toXML();
+Arabica::DOM::Document<std::string> ContextualizedRequest::toXML() const {
+ Document<std::string> doc = MMIEvent::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
msgElem.setAttributeNS(nameSpace, "Context", context);
return doc;
}
-Arabica::DOM::Document<std::string> ContentRequest::toXML() {
+Arabica::DOM::Document<std::string> ContentRequest::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
@@ -92,14 +162,14 @@ Arabica::DOM::Document<std::string> ContentRequest::toXML() {
return doc;
}
-Arabica::DOM::Document<std::string> ExtensionNotification::toXML() {
+Arabica::DOM::Document<std::string> ExtensionNotification::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
msgElem.setAttributeNS(nameSpace, "Name", name);
return doc;
}
-Arabica::DOM::Document<std::string> StatusResponse::toXML() {
+Arabica::DOM::Document<std::string> StatusResponse::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
if (status == ALIVE) {
@@ -114,7 +184,7 @@ Arabica::DOM::Document<std::string> StatusResponse::toXML() {
return doc;
}
-Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() {
+Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() const {
Document<std::string> doc = StatusResponse::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
@@ -126,7 +196,7 @@ Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() {
return doc;
}
-Arabica::DOM::Document<std::string> StatusRequest::toXML() {
+Arabica::DOM::Document<std::string> StatusRequest::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
@@ -139,19 +209,18 @@ Arabica::DOM::Document<std::string> StatusRequest::toXML() {
return doc;
}
-MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- MMIMessage msg;
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+MMIEvent MMIEvent::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ MMIEvent msg;
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- msg.source = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Source");
- msg.target = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Target");
-// msg.data = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Data");
- msg.requestId = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestID");
+ msg.source = STRING_ATTR_OR_EXPR(msgElem, Source);
+ msg.target = STRING_ATTR_OR_EXPR(msgElem, Target);
+// msg.data = STRING_ATTR_OR_EXPR(msgElem, Data);
+ msg.requestId = STRING_ATTR_OR_EXPR(msgElem, RequestID);
msg.tagName = msgElem.getLocalName();
Element<std::string> dataElem;
@@ -167,35 +236,47 @@ MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) {
if (dataElem && boost::iequals(dataElem.getLocalName(), "data")) {
std::stringstream ss;
node = dataElem.getFirstChild();
- while (node) {
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {
- ss << node;
- break;
- }
- node = node.getNextSibling();
- }
+ if (node)
+ ss << node;
msg.data = ss.str();
}
return msg;
}
-ContextualizedRequest ContextualizedRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- ContextualizedRequest msg(NewContextRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+MMIEvent::operator Event() const {
+ Event ev;
+ ev.setOriginType("mmi.event");
+ ev.setOrigin(source);
+ ev.setRaw(data);
+ ev.setSendId(requestId);
+ if (data.length() > 0) {
+ ev.initContent(data);
+ }
+ return ev;
+}
+
+ContextualizedRequest ContextualizedRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ ContextualizedRequest msg(MMIEvent::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- msg.context = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context");
+ msg.context = STRING_ATTR_OR_EXPR(msgElem, Context);
return msg;
}
-ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- ContentRequest msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ContextualizedRequest::operator Event() const {
+ Event ev = MMIEvent::operator Event();
+ // do we want to represent the context? It's the interpreters name already
+ return ev;
+}
+
+
+ContentRequest ContentRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ ContentRequest msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
@@ -228,39 +309,48 @@ ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string>
}
msg.content = ss.str();
} else if(boost::iequals(contentElem.getLocalName(), "contentURL")) {
- msg.contentURL.href = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "href");
- msg.contentURL.maxAge = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "max-age");
- msg.contentURL.fetchTimeout = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "fetchtimeout");
+ msg.contentURL.href = STRING_ATTR_OR_EXPR(contentElem, href);
+ msg.contentURL.maxAge = STRING_ATTR_OR_EXPR(contentElem, max-age);
+ msg.contentURL.fetchTimeout = STRING_ATTR_OR_EXPR(contentElem, fetchtimeout);
}
}
- //msg.content = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context");
+ //msg.content = msgElem.getAttributeNS(nameSpace, "Context");
return msg;
}
-ExtensionNotification ExtensionNotification::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- ExtensionNotification msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ExtensionNotification ExtensionNotification::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ ExtensionNotification msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- msg.name = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Name");
+ msg.name = STRING_ATTR_OR_EXPR(msgElem, Name);
+ msg.type = EXTENSIONNOTIFICATION;
return msg;
}
-StatusResponse StatusResponse::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- StatusResponse msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ExtensionNotification::operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ if (name.length() > 0) {
+ ev.setName("mmi.extensionnotification." + name);
+ } else {
+ ev.setName("mmi.extensionnotification");
+ }
+ return ev;
+}
+
+StatusResponse StatusResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ StatusResponse msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- std::string status = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Status");
+ std::string status = STRING_ATTR_OR_EXPR(msgElem, Status);
if (boost::iequals(status, "ALIVE")) {
msg.status = ALIVE;
@@ -271,12 +361,12 @@ StatusResponse StatusResponse::fromXML(const Arabica::DOM::Document<std::string>
} else if(boost::iequals(status, "SUCCESS")) {
msg.status = SUCCESS;
}
+ msg.type = STATUSRESPONSE;
return msg;
}
-StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- StatusInfoResponse msg(StatusResponse::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+StatusInfoResponse StatusInfoResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ StatusInfoResponse msg(StatusResponse::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
@@ -305,21 +395,19 @@ StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std:
node = node.getNextSibling();
}
}
-
return msg;
}
-StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- StatusRequest msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+StatusRequest StatusRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ StatusRequest msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- std::string autoUpdate = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestAutomaticUpdate");
+ std::string autoUpdate = STRING_ATTR_OR_EXPR(msgElem, RequestAutomaticUpdate);
if (boost::iequals(autoUpdate, "true")) {
msg.automaticUpdate = true;
@@ -332,7 +420,9 @@ StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>&
} else {
msg.automaticUpdate = false;
}
+ msg.type = STATUSREQUEST;
return msg;
}
+
} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
index a5328ac..b7d017f 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
@@ -1,69 +1,142 @@
-#ifndef MMIMESSAGES_H_OS0SE7H5
-#define MMIMESSAGES_H_OS0SE7H5
+#ifndef MMIEVENT_H_OS0SE7H5
+#define MMIEVENT_H_OS0SE7H5
#include <DOM/Node.hpp>
#include <DOM/Document.hpp>
+#include <uscxml/Interpreter.h>
namespace uscxml {
-class MMIMessage {
+class MMIEvent {
public:
- virtual Arabica::DOM::Document<std::string> toXML();
- static MMIMessage fromXML(const Arabica::DOM::Document<std::string>& doc);
-
+ enum Type {
+ NEWCONTEXTREQUEST,
+ NEWCONTEXTRESPONSE,
+ PREPAREREQUEST,
+ PREPARERESPONSE,
+ STARTREQUEST,
+ STARTRESPONSE,
+ DONENOTIFICATION,
+ CANCELREQUEST,
+ CANCELRESPONSE,
+ PAUSEREQUEST,
+ PAUSERESPONSE,
+ RESUMEREQUEST,
+ RESUMERESPONSE,
+ EXTENSIONNOTIFICATION,
+ CLEARCONTEXTREQUEST,
+ CLEARCONTEXTRESPONSE,
+ STATUSREQUEST,
+ STATUSRESPONSE,
+ INVALID
+ };
+
+ static Type getType(Arabica::DOM::Node<std::string> node);
+ static Arabica::DOM::Node<std::string> getEventNode(Arabica::DOM::Node<std::string> node);
+
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static MMIEvent fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+
+ // conversion operator
+ operator Event() const;
+
std::string source;
std::string target;
std::string data;
std::string requestId;
std::string tagName;
-
+ Type type;
+
static std::string nameSpace;
protected:
- MMIMessage() {}
+ MMIEvent() {}
};
-class NewContextRequest : public MMIMessage {
+class MMIEventReceiver {
public:
- NewContextRequest() {
- tagName = "NewContextRequest";
- }
- NewContextRequest(const MMIMessage& father) : MMIMessage(father) {}
- static NewContextRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return MMIMessage::fromXML(doc);
- }
+ virtual void received(const MMIEvent& mmiEvent) = 0;
+};
+class MMIEventSender {
+public:
+ virtual void send(const MMIEvent& mmiEvent) = 0;
};
-class ContextualizedRequest : public NewContextRequest {
+class NewContextRequest : public MMIEvent {
public:
- virtual Arabica::DOM::Document<std::string> toXML();
- static ContextualizedRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+ NewContextRequest() {
+ tagName = "NewContextRequest";
+ type = NEWCONTEXTREQUEST;
+ }
+ NewContextRequest(const MMIEvent& father) : MMIEvent(father) {}
+ static NewContextRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ MMIEvent event = MMIEvent::fromXML(node, interpreter);
+ event.type = NEWCONTEXTREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = MMIEvent::operator Event();
+ ev.setName("mmi.newcontextrequest");
+ ev.setDOM(toXML());
+ return ev;
+ }
+ std::string token; ///< special token for server-less modality components
+};
+class ContextualizedRequest : public MMIEvent {
+public:
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static ContextualizedRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
std::string context;
protected:
ContextualizedRequest() {}
- ContextualizedRequest(const NewContextRequest& father) : NewContextRequest(father) {}
+ ContextualizedRequest(const MMIEvent& father) : MMIEvent(father) {}
};
class PauseRequest : public ContextualizedRequest {
public:
PauseRequest() {
tagName = "PauseRequest";
+ type = PAUSEREQUEST;
}
PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static PauseRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static PauseRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PauseRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = PAUSEREQUEST;
+ return event;
}
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setName("mmi.pauserequest");
+ ev.setDOM(toXML());
+ return ev;
+ }
+
};
class ResumeRequest : public ContextualizedRequest {
public:
ResumeRequest() {
tagName = "ResumeRequest";
+ type = RESUMEREQUEST;
}
ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static ResumeRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static ResumeRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ResumeRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = RESUMEREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setDOM(toXML());
+ ev.setName("mmi.resumerequest");
+ return ev;
}
};
@@ -71,10 +144,20 @@ class CancelRequest : public ContextualizedRequest {
public:
CancelRequest() {
tagName = "CancelRequest";
+ type = CANCELREQUEST;
}
CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static CancelRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static CancelRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ CancelRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = CANCELREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setName("mmi.cancelrequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -82,10 +165,20 @@ class ClearContextRequest : public ContextualizedRequest {
public:
ClearContextRequest() {
tagName = "ClearContextRequest";
+ type = CLEARCONTEXTREQUEST;
}
ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static ClearContextRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static ClearContextRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ClearContextRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = CLEARCONTEXTREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setName("mmi.clearcontextrequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -93,10 +186,12 @@ class StatusRequest : public ContextualizedRequest {
public:
StatusRequest() {
tagName = "StatusRequest";
+ type = STARTREQUEST;
}
- virtual Arabica::DOM::Document<std::string> toXML();
- static StatusRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
-
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static StatusRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
bool automaticUpdate;
protected:
StatusRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
@@ -110,8 +205,10 @@ public:
std::string fetchTimeout;
};
- virtual Arabica::DOM::Document<std::string> toXML();
- static ContentRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static ContentRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
std::string content;
ContentURL contentURL;
protected:
@@ -123,10 +220,20 @@ class PrepareRequest : public ContentRequest {
public:
PrepareRequest() {
tagName = "PrepareRequest";
+ type = PREPAREREQUEST;
}
PrepareRequest(const ContentRequest& father) : ContentRequest(father) {}
- static PrepareRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContentRequest::fromXML(doc);
+ static PrepareRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PrepareRequest event = ContentRequest::fromXML(node, interpreter);
+ event.type = PREPAREREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContentRequest::operator Event();
+ ev.setName("mmi.preparerequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -134,10 +241,20 @@ class StartRequest : public ContentRequest {
public:
StartRequest() {
tagName = "StartRequest";
+ type = STARTREQUEST;
}
StartRequest(const ContentRequest& father) : ContentRequest(father) {}
- static StartRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContentRequest::fromXML(doc);
+ static StartRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ StartRequest event = ContentRequest::fromXML(node, interpreter);
+ event.type = STARTREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContentRequest::operator Event();
+ ev.setName("mmi.startrequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -146,10 +263,12 @@ class ExtensionNotification : public ContextualizedRequest {
public:
ExtensionNotification() {
tagName = "ExtensionNotification";
+ type = EXTENSIONNOTIFICATION;
}
- virtual Arabica::DOM::Document<std::string> toXML();
- static ExtensionNotification fromXML(const Arabica::DOM::Document<std::string>& doc);
-
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static ExtensionNotification fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
std::string name;
protected:
ExtensionNotification(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
@@ -167,33 +286,45 @@ public:
StatusResponse() {
tagName = "StatusResponse";
+ type = STATUSRESPONSE;
}
- virtual Arabica::DOM::Document<std::string> toXML();
- static StatusResponse fromXML(const Arabica::DOM::Document<std::string>& doc);
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static StatusResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
Status status;
protected:
StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
-
};
class StatusInfoResponse : public StatusResponse {
public:
- virtual Arabica::DOM::Document<std::string> toXML();
- static StatusInfoResponse fromXML(const Arabica::DOM::Document<std::string>& doc);
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
+ static StatusInfoResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
std::string statusInfo;
protected:
StatusInfoResponse() {}
- StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
};
class PrepareResponse : public StatusInfoResponse {
public:
PrepareResponse() {
tagName = "PrepareResponse";
+ type = PREPARERESPONSE;
}
PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static PrepareResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static PrepareResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PrepareResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = PREPARERESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.prepareresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -201,10 +332,20 @@ class StartResponse : public StatusInfoResponse {
public:
StartResponse() {
tagName = "StartResponse";
+ type = STARTRESPONSE;
}
StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static StartResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static StartResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ StartResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = STARTRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.startresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -212,10 +353,20 @@ class CancelResponse : public StatusInfoResponse {
public:
CancelResponse() {
tagName = "CancelResponse";
+ type = CANCELRESPONSE;
}
CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static CancelResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static CancelResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ CancelResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = CANCELRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.cancelresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -223,10 +374,20 @@ class PauseResponse : public StatusInfoResponse {
public:
PauseResponse() {
tagName = "PauseResponse";
+ type = PAUSERESPONSE;
}
PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static PauseResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static PauseResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PauseResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = PAUSERESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.pauseresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -234,10 +395,20 @@ class ResumeResponse : public StatusInfoResponse {
public:
ResumeResponse() {
tagName = "ResumeResponse";
+ type = RESUMERESPONSE;
}
ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static ResumeResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static ResumeResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ResumeResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = RESUMERESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.resumeresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -245,10 +416,20 @@ class ClearContextResponse : public StatusInfoResponse {
public:
ClearContextResponse() {
tagName = "ClearContextResponse";
+ type = CLEARCONTEXTRESPONSE;
}
ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static ClearContextResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static ClearContextResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ClearContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = CLEARCONTEXTRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.clearcontextresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -256,10 +437,20 @@ class NewContextResponse : public StatusInfoResponse {
public:
NewContextResponse() {
tagName = "NewContextResponse";
+ type = NEWCONTEXTRESPONSE;
}
NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static NewContextResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static NewContextResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ NewContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = NEWCONTEXTRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.newcontextresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -268,13 +459,23 @@ class DoneNotification : public StatusInfoResponse {
public:
DoneNotification() {
tagName = "DoneNotification";
+ type = DONENOTIFICATION;
}
DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static DoneNotification fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static DoneNotification fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ DoneNotification event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = DONENOTIFICATION;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.donenotification");
+ ev.setDOM(toXML());
+ return ev;
}
};
}
-#endif /* end of include guard: MMIMESSAGES_H_OS0SE7H5 */
+#endif /* end of include guard: MMIEVENT_H_OS0SE7H5 */
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 70b272f..bd24326 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -164,6 +164,10 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
request.data.compound["path"] = Data(evhttp_uri_get_path(evhttp_request_get_evhttp_uri(req)), Data::VERBATIM);
raw << " " << request.data.compound["path"].atom;
+ const char* query = evhttp_uri_get_query(evhttp_request_get_evhttp_uri(req));
+ if (query)
+ raw << "?" << std::string(query);
+
raw << " HTTP/" << request.data.compound["httpMajor"].atom << "." << request.data.compound["httpMinor"].atom;
raw << std::endl;
@@ -197,7 +201,6 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
// parse query string
struct evkeyvalq params;
struct evkeyval *param;
- const char* query = evhttp_uri_get_query(evhttp_request_get_evhttp_uri(req));
evhttp_parse_query_str(query, &params);
for (param = params.tqh_first; param; param = param->next.tqe_next) {
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
index 7356737..bd54166 100644
--- a/src/uscxml/server/HTTPServer.h
+++ b/src/uscxml/server/HTTPServer.h
@@ -20,6 +20,10 @@ public:
Request() : curlReq(NULL) {}
std::string content;
struct evhttp_request* curlReq;
+
+ operator bool() {
+ return curlReq != NULL;
+ }
};
class Reply {
diff --git a/test/samples/uscxml/templates/mc-html.html b/test/samples/uscxml/templates/mc-html.html
new file mode 100644
index 0000000..78bb34e
--- /dev/null
+++ b/test/samples/uscxml/templates/mc-html.html
@@ -0,0 +1,161 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js"></script>
+
+ <script type="text/javascript">
+ function createUUID() {
+ // http://www.ietf.org/rfc/rfc4122.txt
+ var s = [];
+ var hexDigits = "0123456789abcdef";
+ for (var i = 0; i < 36; i++) {
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
+ }
+ s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
+ s[8] = s[13] = s[18] = s[23] = "-";
+ var uuid = s.join("");
+ return uuid;
+ }
+ </script>
+
+ <script type="text/javascript">
+ require(["dojo/on", "dojo/mouse", "dojo/domReady!", "dojo", "dojox/json/ref"], function(on, mouse, dom, dojo, ref) {
+
+ var element = dojo.byId("foo");
+
+ var mmiNS = "http://www.w3.org/2008/04/mmi-arch";
+ var token = createUUID();
+ var contextId;
+ var timeout="30000";
+ var imURL = "${im.url}";
+
+ var xhr = dojo.require("dojo/_base/xhr");
+ // initial new context request
+ xhr.post({
+ url: imURL + "?token=" + token,
+ postData:
+ '<mmi:mmi xmlns:mmi="' + mmiNS + '" version="1.0">' +
+ '<mmi:NewContextRequest ' +
+ 'mmi:Source="HTML" ' +
+ 'mmi:Target="' + imURL + '" '+
+ 'mmi:RequestID="' + token + '" />' +
+ '</mmi:mmi>',
+ handleAs:"xml",
+ headers:{
+ "X-Requested-With": null,
+ "Content-Type": "application/xml",
+ },
+ load: function(result) {
+ // scxml IM replied with 204 - longpoll via get
+ longpoll();
+ }
+ });
+
+ var longpoll = function() {
+ xhr.get({
+ // The URL to request
+ url: imURL + "?token=" + token,
+ handleAs:"xml",
+ headers:{
+ "X-Requested-With": null,
+ "Content-Type": "application/xml",
+ },
+ load: function(result) {
+ // IM had some event to send to us
+ element.innerHTML += (new XMLSerializer()).serializeToString(result).replace(/</gi, "&lt;") + "<br />";
+ var mmiEvent = result.documentElement.firstChild;
+ switch (mmiEvent.localName) {
+ case "NewContextResponse":
+ newContextResponse(mmiEvent);
+ break;
+ case "StartRequest":
+ startRequest(mmiEvent);
+ break;
+ }
+ longpoll();
+ }
+ });
+ }
+
+ var eventToJSON = function(event) {
+ var seen = [];
+ return JSON.stringify(event, function(key, val) {
+ if (isNode(val)) {
+ return;
+ }
+ if (isWindow(val)) {
+ return;
+ }
+ if (typeof val == "object") {
+ if (seen.indexOf(val) >= 0)
+ return;
+ seen.push(val)
+ }
+ return val
+ });
+ }
+
+ var isNode = function(o){
+ return (
+ typeof Node === "object" ? o instanceof Node :
+ o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
+ );
+ }
+
+ var isWindow = function(o){
+ return (
+ typeof Window === "object" ? o instanceof Window :
+ o && typeof o === "object" && typeof o.menubar === "object"
+ );
+ }
+
+ var newContextResponse = function(event) {
+ contextId = event.getAttribute("Context");
+ }
+ var startRequest = function(event) {
+ var content = event.firstChild;
+ console.log(content);
+ var fromStartRequest = document.importNode(content.firstChild,true);
+ element.appendChild(fromStartRequest);
+ }
+
+ var sendExtensionNotification = function(event) {
+ console.log(event);
+ var data = eventToJSON(event);
+ console.log(data);
+ xhr.post({
+ url: imURL + "?token=" + token,
+ postData:
+ '<mmi:mmi xmlns:mmi="' + mmiNS + '" version="1.0">' +
+ '<mmi:ExtensionNotification ' +
+ 'mmi:Source="HTML" ' +
+ 'mmi:Target="' + imURL + '" ' +
+ 'mmi:Context="' + contextId + '" ' +
+ 'mmi:RequestID="' + token + '">' +
+ '<mmi:Data>' + data + '</mmi:Data>' +
+ '</mmi:ExtensionNotification>' +
+ '</mmi:mmi>',
+ handleAs:"xml",
+ headers:{
+ "X-Requested-With": null,
+ "Content-Type": "application/xml",
+ },
+ load: function(result) {
+ // scxml IM replied with 204
+ }
+ });
+
+ }
+
+ on(element, "click", sendExtensionNotification);
+ on(element, mouse.enter, sendExtensionNotification);
+ on(element, mouse.leave, sendExtensionNotification);
+
+ });
+ </script>
+ </head>
+ <body class="tundra">
+ <div id="foo"></div>
+ </body>
+</html>
diff --git a/test/samples/uscxml/test-mmi-events.scxml b/test/samples/uscxml/test-mmi-events.scxml
new file mode 100644
index 0000000..9460a6e
--- /dev/null
+++ b/test/samples/uscxml/test-mmi-events.scxml
@@ -0,0 +1,88 @@
+<scxml datamodel="ecmascript"
+ xmlns:mmi="http://www.w3.org/2008/04/mmi-arch"
+ xmlns="http://www.w3.org/2005/07/scxml">
+ <!--
+ This is a sample implementation for a modality component in the W3C MMI Architecture using SCXML
+ -->
+ <state id="idle">
+ <onentry>
+ <log expr="'Entering idle state'" />
+ <send targetexpr="_ioprocessors['mmihttp'].location">
+ <mmi:PrepareRequest
+ <mmi:content>
+ <scxml datamodel="ecmascript">
+ <state>
+ <onentry>
+ <log expr="" />
+ </onentry>
+ </state>
+ </scxml>
+ </mmi:content>
+ </mmi:PrepareRequest>
+ </send>
+ </onentry>
+
+ <transition event="mmi.prepare.request" target="idle">
+ <log expr="'Received PrepareRequest'" />
+ <mmi:mmi xmlns:mmi="http://www.w3.org/2008/04/mmi-arch" version="1.0">
+ <mmi:PrepareResponse
+ mmi:SourceExpr="_ioprocessors['basichttp'].location"
+ mmi:TargetExpr="someOtherURI"
+ mmi:ContextExpr="someURI"
+ mmi:RequestIDExpr="_event.data.getElementsByTagName('PrepareRequest')[0].getAttribute('RequestID')"
+ mmi:Status="success"/>
+ </mmi:mmi>
+ </transition>
+ <transition event="mmi.start.request" target="running">
+ <log expr="'Received StartRequest'" />
+ </transition>
+ <transition event="mmi.clearcontext.request" target="terminate">
+ <log expr="'Received ClearContextRequest'" />
+ </transition>
+ </state>
+
+ <state id="paused">
+ <onentry>
+ <log expr="'Entering pause state'">
+ </onentry>
+ <transition event="mmi.prepare.request" target="paused">
+ <log expr="'Received PrepareRequest'" />
+ </transition>
+ <transition event="mmi.start.request" target="running">
+ <log expr="'Received StartRequest'" />
+ </transition>
+ <transition event="mmi.resume.request" target="running">
+ <log expr="'Received ResumeRequest'" />
+ </transition>
+ <transition event="mmi.cancel.request" target="idle">
+ <log expr="'Received CancelRequest'" />
+ </transition>
+ <transition event="mmi.clearcontext.request" target="terminate">
+ <log expr="'Received ClearContextRequest'" />
+ </transition>
+ </state>
+
+ <state id="running">
+ <onentry>
+ <log expr="'Entering running state'">
+ </onentry>
+ <transition event="mmi.prepare.request" target="running">
+ <log expr="'Received PrepareRequest'" />
+ </transition>
+ <transition event="mmi.pause.request" target="paused">
+ <log expr="'Received PauseRequest'" />
+ </transition>
+ <transition event="mmi.cancel.request" target="idle">
+ <log expr="'Received CancelRequest'" />
+ </transition>
+ <transition event="mmi.clearcontext.request" target="terminate">
+ <log expr="'Received ClearContextRequest'" />
+ </transition>
+ </state>
+
+ <final id="terminate">
+ <onentry>
+ <log expr="'Entering terminate state'">
+ </onentry>
+ </final>
+</scxml> \ No newline at end of file
diff --git a/test/samples/uscxml/test-mmi-im.scxml b/test/samples/uscxml/test-mmi-im.scxml
new file mode 100644
index 0000000..4b130bd
--- /dev/null
+++ b/test/samples/uscxml/test-mmi-im.scxml
@@ -0,0 +1,69 @@
+<scxml datamodel="ecmascript" name="mmi-test"
+ xmlns:mmi="http://www.w3.org/2008/04/mmi-arch"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/2005/07/scxml">
+
+ <script>
+<![CDATA[
+
+ function dump(object, level) {
+ if (!level) level = 0;
+
+ var padding = "";
+ for (var j=0;j < level+1;j++) padding += " ";
+
+ if (typeof(object) == 'object') {
+ for (var item in object) {
+ if (item === "lastChild") continue;
+ if (item === "firstChild") continue;
+ if (item === "ownerDocument") continue;
+ var value = object[item];
+
+ if(typeof(value) == 'object') {
+ print (padding + "'" + item + "' ...\n");
+ dump (value, level+1);
+ } else {
+ print (padding + "'" + item + "' => \"" + value + "\"\n");
+ }
+ }
+ } else {
+ print("===> " + object + " <===(" + typeof(object) + ")");
+ }
+ }
+]]>
+ </script>
+
+ <state id="startmc">
+ <!-- invoke type="vxml" id="mc.vxml" / -->
+
+ <!-- Idle here and wait for events -->
+ <state id="idle">
+
+ <!-- setup session -->
+ <transition event="mmi.newcontextrequest" target="idle">
+
+ <send type="mmi.event">
+ <content>
+ <mmi:NewContextResponse mmi:Status="success" />
+ </content>
+ </send>
+
+ <send type="mmi.event">
+ <content>
+ <mmi:StartRequest>
+ <mmi:Content>
+ <html:button>Click Me</html:button>
+ </mmi:Content>
+ </mmi:StartRequest>
+ </content>
+ </send>
+ </transition>
+
+ <transition event="mmi.extensionnotification" target="idle">
+ <script>dump(_event)</script>
+ </transition>
+
+ </state>
+ </state>
+ <final id="terminate" />
+</scxml> \ No newline at end of file
diff --git a/test/samples/uscxml/test-mmi-mc.scxml b/test/samples/uscxml/test-mmi-mc.scxml
new file mode 100644
index 0000000..e2197ff
--- /dev/null
+++ b/test/samples/uscxml/test-mmi-mc.scxml
@@ -0,0 +1,83 @@
+<scxml datamodel="ecmascript" name="sample-mc">
+ <!--
+ This is a sample implementation for a modality component in the W3C MMI Architecture using SCXML.
+ We enter an idle state and wait for StartRequests from an IM.
+ -->
+ <state id="idle">
+ <onentry>
+ <log expr="'Entering idle state'" />
+ </onentry>
+ <transition event="mmi.prepare.request" target="idle">
+ <log expr="'Received PrepareRequest'" />
+ <send type="mmihttp">
+ <mmi:PrepareResponse
+ mmi:SourceExpr="_ioprocessors['mmihttp'].location"
+ mmi:TargetExpr="_event.data.getElementsByTagName('PrepareRequest')[0].getAttribute('Source')"
+ mmi:ContextExpr="_event.data.getElementsByTagName('PrepareRequest')[0].getAttribute('Context')"
+ mmi:RequestIDExpr="_event.data.getElementsByTagName('PrepareRequest')[0].getAttribute('RequestID')"
+ mmi:Status="success"/>
+ </transition>
+
+ <transition event="mmi.start.request" target="running">
+ <log expr="'Received StartRequest'" />
+ </transition>
+
+ <transition event="mmi.clearcontext.request" target="terminate">
+ <log expr="'Received ClearContextRequest'" />
+ </transition>
+ </state>
+
+ <state id="paused">
+ <onentry>
+ <log expr="'Entering pause state'">
+ </onentry>
+
+ <transition event="mmi.prepare.request" target="paused">
+ <log expr="'Received PrepareRequest'" />
+ </transition>
+
+ <transition event="mmi.start.request" target="running">
+ <log expr="'Received StartRequest'" />
+ </transition>
+
+ <transition event="mmi.resume.request" target="running">
+ <log expr="'Received ResumeRequest'" />
+ </transition>
+
+ <transition event="mmi.cancel.request" target="idle">
+ <log expr="'Received CancelRequest'" />
+ </transition>
+
+ <transition event="mmi.clearcontext.request" target="terminate">
+ <log expr="'Received ClearContextRequest'" />
+ </transition>
+ </state>
+
+ <state id="running">
+ <onentry>
+ <log expr="'Entering running state'">
+ </onentry>
+
+ <transition event="mmi.prepare.request" target="running">
+ <log expr="'Received PrepareRequest'" />
+ </transition>
+
+ <transition event="mmi.pause.request" target="paused">
+ <log expr="'Received PauseRequest'" />
+ </transition>
+
+ <transition event="mmi.cancel.request" target="idle">
+ <log expr="'Received CancelRequest'" />
+ </transition>
+
+ <transition event="mmi.clearcontext.request" target="terminate">
+ <log expr="'Received ClearContextRequest'" />
+ </transition>
+ </state>
+
+ <final id="terminate">
+ <onentry>
+ <log expr="'Entering terminate state'">
+ </onentry>
+ </final>
+</scxml> \ No newline at end of file