diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-30 17:03:48 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-30 17:03:48 (GMT) |
commit | c8f8923484cbc99eff1e3c0b703568b243f3728b (patch) | |
tree | 379e7965a576f67d62d088d5a2b8d2072529b8e2 | |
parent | 8b803e4bf8d33df7c21b886c681963e80f2b2f8b (diff) | |
download | uscxml-c8f8923484cbc99eff1e3c0b703568b243f3728b.zip uscxml-c8f8923484cbc99eff1e3c0b703568b243f3728b.tar.gz uscxml-c8f8923484cbc99eff1e3c0b703568b243f3728b.tar.bz2 |
New php wrapper
-rw-r--r-- | src/bindings/swig/php/uscxmlNativePHP.php | 74 | ||||
-rw-r--r-- | test/src/test-predicates.cpp | 1 |
2 files changed, 42 insertions, 33 deletions
diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php index 7a63a1a..85cef6c 100644 --- a/src/bindings/swig/php/uscxmlNativePHP.php +++ b/src/bindings/swig/php/uscxmlNativePHP.php @@ -580,7 +580,7 @@ class InterpreterMonitor { } } -class Interpreter { +abstract class Interpreter { public $_cPtr=null; protected $_pData=array(); @@ -614,46 +614,26 @@ class Interpreter { static function fromDOM($node) { $r=Interpreter_fromDOM($node); - 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; + $this->_cPtr = $r; + return $this; } static function fromXML($xml) { $r=Interpreter_fromXML($xml); - 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; + $this->_cPtr = $r; + return $this; } static function fromURI($uri) { $r=Interpreter_fromURI($uri); - 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; + $this->_cPtr = $r; + return $this; } static function fromInputSource($source) { $r=Interpreter_fromInputSource($source); - 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 startPrefixMapping($arg1,$arg2) { - Interpreter_startPrefixMapping($this->_cPtr,$arg1,$arg2); + $this->_cPtr = $r; + return $this; } function start() { @@ -760,10 +740,18 @@ class Interpreter { return Interpreter_getConfiguration($this->_cPtr); } + function setConfiguration($states) { + Interpreter_setConfiguration($this->_cPtr,$states); + } + function getState($stateId) { return Interpreter_getState($this->_cPtr,$stateId); } + function getStates($stateIds) { + return Interpreter_getStates($this->_cPtr,$stateIds); + } + function getDocument() { return Interpreter_getDocument($this->_cPtr); } @@ -840,14 +828,24 @@ class Interpreter { return Interpreter_isDescendant($s1,$s2); } + static function tokenizeIdRefs($idRefs) { + $r=Interpreter_tokenizeIdRefs($idRefs); + 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 ParamList($r); + } + return $r; + } + function isInitial($state) { return Interpreter_isInitial($this->_cPtr,$state); } - function getInitialState($state=null) { + function getInitialStates($state=null) { switch (func_num_args()) { - case 0: $r=Interpreter_getInitialState($this->_cPtr); break; - default: $r=Interpreter_getInitialState($this->_cPtr,$state); + case 0: $r=Interpreter_getInitialStates($this->_cPtr); break; + default: $r=Interpreter_getInitialStates($this->_cPtr,$state); } return $r; } @@ -860,10 +858,22 @@ class Interpreter { return Interpreter_getTargetStates($this->_cPtr,$transition); } + function getSourceState($transition) { + return Interpreter_getSourceState($this->_cPtr,$transition); + } + static function filterChildElements($tagname_or_tagName,$node_or_nodeSet) { return Interpreter_filterChildElements($tagname_or_tagName,$node_or_nodeSet); } + function findLCCA($states) { + return Interpreter_findLCCA($this->_cPtr,$states); + } + + function getProperAncestors($s1,$s2) { + return Interpreter_getProperAncestors($this->_cPtr,$s1,$s2); + } + static function getUUID() { return Interpreter_getUUID(); } diff --git a/test/src/test-predicates.cpp b/test/src/test-predicates.cpp index 2b2146e..08aa3e1 100644 --- a/test/src/test-predicates.cpp +++ b/test/src/test-predicates.cpp @@ -30,7 +30,6 @@ int main(int argc, char** argv) { assert(Interpreter::isParallel(parallelState)); assert(!Interpreter::isCompound(parallelState)); // parallel states are not compound! - NodeSet<std::string> initialState = interpreter->getInitialStates(); assert(initialState[0] == atomicState); |