summaryrefslogtreecommitdiffstats
path: root/src/uscxml/DOMUtils.h
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-06-27 22:32:46 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-06-27 22:32:46 (GMT)
commitc70d02010ea99e6c8e35da3b767f41f1ee5dce56 (patch)
treea0ef030204ec2eb656845d03876006d9cdc0760c /src/uscxml/DOMUtils.h
parenta4b506fd774ec50ad79b7531bd3698c5a6339407 (diff)
downloaduscxml-c70d02010ea99e6c8e35da3b767f41f1ee5dce56.zip
uscxml-c70d02010ea99e6c8e35da3b767f41f1ee5dce56.tar.gz
uscxml-c70d02010ea99e6c8e35da3b767f41f1ee5dce56.tar.bz2
Major header movement
- Used IWYU to reorganize headers - Dropped PHP support - Updated tests
Diffstat (limited to 'src/uscxml/DOMUtils.h')
-rw-r--r--src/uscxml/DOMUtils.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/uscxml/DOMUtils.h b/src/uscxml/DOMUtils.h
index 178f32a..7748f48 100644
--- a/src/uscxml/DOMUtils.h
+++ b/src/uscxml/DOMUtils.h
@@ -24,6 +24,7 @@
#include <DOM/SAX2DOM/SAX2DOM.hpp>
#include <SAX/helpers/DefaultHandler.hpp>
#include <SAX/helpers/CatchErrorHandler.hpp>
+#include <DOM/io/Stream.hpp> // operator<< for nodes
#define TAGNAME(elem) ((Arabica::DOM::Element<std::string>)elem).getTagName()
#define LOCALNAME(elem) ((Arabica::DOM::Element<std::string>)elem).getLocalName()
@@ -40,6 +41,31 @@ public:
static bool attributeIsTrue(const::std::string& value);
};
+class USCXML_API NumAttr {
+public:
+ NumAttr(const std::string& str) {
+ size_t valueStart = str.find_first_of("0123456789.");
+ if (valueStart != std::string::npos) {
+ size_t valueEnd = str.find_last_of("0123456789.");
+ if (valueEnd != std::string::npos) {
+ value = str.substr(valueStart, (valueEnd - valueStart) + 1);
+ size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1);
+ if (unitStart != std::string::npos) {
+ size_t unitEnd = str.find_last_of(" \t");
+ if (unitEnd != std::string::npos && unitEnd > unitStart) {
+ unit = str.substr(unitStart, unitEnd - unitStart);
+ } else {
+ unit = str.substr(unitStart, str.length() - unitStart);
+ }
+ }
+ }
+ }
+ }
+
+ std::string value;
+ std::string unit;
+};
+
class ScriptEntityResolver : public Arabica::SAX::EntityResolver<std::string> {
virtual InputSourceT resolveEntity(const std::string& publicId, const std::string& systemId) {
Arabica::SAX::InputSource<std::string> is;