/Doc/tut/

content='cgit v0.12'/>
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-30 17:31:50 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-30 17:31:50 (GMT)
commit5cdc1f8ec070fc3b8d03bde36a1854e7291790a2 (patch)
treea13531d9ce29693e5c3b4c8f6396dfac4bbf4290 /src
parentc8f8923484cbc99eff1e3c0b703568b243f3728b (diff)
downloaduscxml-5cdc1f8ec070fc3b8d03bde36a1854e7291790a2.zip
uscxml-5cdc1f8ec070fc3b8d03bde36a1854e7291790a2.tar.gz
uscxml-5cdc1f8ec070fc3b8d03bde36a1854e7291790a2.tar.bz2
Interpreter cannot be abstract for PHP wrappers to work
Diffstat (limited to 'src')
-rw-r--r--src/bindings/swig/php/uscxmlNativePHP.php58
-rw-r--r--src/uscxml/Interpreter.cpp11
-rw-r--r--src/uscxml/Interpreter.h2
-rw-r--r--src/uscxml/interpreter/InterpreterDraft7.cpp9
4 files changed, 44 insertions, 36 deletions
diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php
index 85cef6c..7a1b9f8 100644
--- a/src/bindings/swig/php/uscxmlNativePHP.php
+++ b/src/bindings/swig/php/uscxmlNativePHP.php
@@ -210,6 +210,14 @@ class Event {
Event_setDOM($this->_cPtr,$dom);
}
+ function getContent() {
+ return Event_getContent($this->_cPtr);
+ }
+
+ function setContent($content) {
+ Event_setContent($this->_cPtr,$content);
+ }
+
function getSendId() {
return Event_getSendId($this->_cPtr);
}
@@ -310,14 +318,6 @@ class InvokeRequest extends Event {
InvokeRequest_setSource($this->_cPtr,$src);
}
- function getContent() {
- return InvokeRequest_getContent($this->_cPtr);
- }
-
- function setContent($content) {
- InvokeRequest_setContent($this->_cPtr,$content);
- }
-
function isAutoForwarded() {
return InvokeRequest_isAutoForwarded($this->_cPtr);
}
@@ -444,14 +444,6 @@ class SendRequest extends Event {
SendRequest_setDelayMs($this->_cPtr,$delayMs);
}
- function getContent() {
- return SendRequest_getContent($this->_cPtr);
- }
-
- function setContent($content) {
- SendRequest_setContent($this->_cPtr,$content);
- }
-
function getNameList() {
$r=SendRequest_getNameList($this->_cPtr);
if (is_resource($r)) {
@@ -580,7 +572,7 @@ class InterpreterMonitor {
}
}
-abstract class Interpreter {
+class Interpreter {
public $_cPtr=null;
protected $_pData=array();
@@ -614,26 +606,42 @@ abstract class Interpreter {
static function fromDOM($node) {
$r=Interpreter_fromDOM($node);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
static function fromXML($xml) {
$r=Interpreter_fromXML($xml);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
static function fromURI($uri) {
$r=Interpreter_fromURI($uri);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
static function fromInputSource($source) {
$r=Interpreter_fromInputSource($source);
- $this->_cPtr = $r;
- return $this;
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
}
function start() {
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 089406d..37f2b77 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -573,15 +573,8 @@ void Interpreter::send(const Arabica::DOM::Node<std::string>& element) {
// use the whole dom
Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
sendReq.dom = domFactory.createDocument(contents[0].getNamespaceURI(), "", 0);
- for (int i = 0; i < contentChilds.getLength(); i++) {
- try {
- Node<std::string> newNode = sendReq.dom.importNode(contentChilds.item(i), true);
- sendReq.dom.appendChild(newNode);
- } catch (...) {
-
- }
- }
- std::cout << sendReq.dom << std::endl;
+ Node<std::string> newNode = sendReq.dom.importNode(contents[0], true);
+ sendReq.dom.appendChild(newNode);
} else {
Node<std::string> textChild = contents[0].getFirstChild();
while(textChild && textChild.getNodeType() != Node_base::TEXT_NODE) {
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h