summaryrefslogtreecommitdiffstats
path: root/src/uscxml/util/Predicates.cpp
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-06-16 14:51:27 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-06-16 14:51:27 (GMT)
commitfa6b4f074d4be04d913d8b7dc062920341c34ecb (patch)
tree83ae475b184a3b1bccca2a69addcefb6c12d924e /src/uscxml/util/Predicates.cpp
parented6aee05e2843be65c4ab445d79e70dc8dacc07b (diff)
downloaduscxml-fa6b4f074d4be04d913d8b7dc062920341c34ecb.zip
uscxml-fa6b4f074d4be04d913d8b7dc062920341c34ecb.tar.gz
uscxml-fa6b4f074d4be04d913d8b7dc062920341c34ecb.tar.bz2
Fixed issue86 and some more bug fixes
Diffstat (limited to 'src/uscxml/util/Predicates.cpp')
-rw-r--r--src/uscxml/util/Predicates.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/uscxml/util/Predicates.cpp b/src/uscxml/util/Predicates.cpp
index cd41089..006e8dc 100644
--- a/src/uscxml/util/Predicates.cpp
+++ b/src/uscxml/util/Predicates.cpp
@@ -460,16 +460,25 @@ std::list<DOMElement*> getReachableStates(const DOMElement* root) {
}
-bool isInEmbeddedDocument(const DOMNode* node) {
- // a node is in an embedded document if there is a content element in its parents
- const DOMNode* parent = node;
- while(parent) {
- if(iequals(LOCALNAME(parent), "content")) {
- return true;
+bool areFromSameMachine(const DOMNode* n1, const DOMNode* n2) {
+ // we traverse each nodes parent's until we reach an scxml element or null
+ const DOMNode* p1 = n1;
+ while(p1) {
+ if(iequals(LOCALNAME(p1), "scxml")) {
+ break;
}
- parent = parent->getParentNode();
+ p1 = p1->getParentNode();
}
- return false;
+
+ const DOMNode* p2 = n2;
+ while(p2) {
+ if(iequals(LOCALNAME(p2), "scxml")) {
+ break;
+ }
+ p2 = p2->getParentNode();
+ }
+
+ return p1 == p2;
}
} \ No newline at end of file