diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-05-19 08:03:50 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-05-19 08:03:50 (GMT) |
commit | 5de792adc6796b0f03d62124765b4af0676dde46 (patch) | |
tree | e700d6b008b21c037aebcc1882fd9286920b2987 /src/uscxml/util | |
parent | f8e0c96fddfdd5f086e1bd973d6b0a19c39c93da (diff) | |
download | uscxml-5de792adc6796b0f03d62124765b4af0676dde46.zip uscxml-5de792adc6796b0f03d62124765b4af0676dde46.tar.gz uscxml-5de792adc6796b0f03d62124765b4af0676dde46.tar.bz2 |
Refactored for public headers and started documentation
Diffstat (limited to 'src/uscxml/util')
-rw-r--r-- | src/uscxml/util/DOM.cpp | 18 | ||||
-rw-r--r-- | src/uscxml/util/DOM.h | 73 | ||||
-rw-r--r-- | src/uscxml/util/Predicates.cpp | 6 | ||||
-rw-r--r-- | src/uscxml/util/Predicates.h | 52 | ||||
-rw-r--r-- | src/uscxml/util/URL.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/util/URL.h | 3 | ||||
-rw-r--r-- | src/uscxml/util/UUID.cpp | 8 | ||||
-rw-r--r-- | src/uscxml/util/UUID.h | 2 |
8 files changed, 84 insertions, 80 deletions
diff --git a/src/uscxml/util/DOM.cpp b/src/uscxml/util/DOM.cpp index b68901c..0e1e9fa 100644 --- a/src/uscxml/util/DOM.cpp +++ b/src/uscxml/util/DOM.cpp @@ -36,7 +36,7 @@ namespace uscxml { -using namespace xercesc; +using namespace XERCESC_NS; std::ostream& operator<< (std::ostream& os, const DOMNode& node) { @@ -233,8 +233,8 @@ void DOMUtils::inPostFixOrder(const std::set<std::string>& elements, const bool includeEmbeddedDoc, std::list<DOMElement*>& nodes) { - if (root == NULL) - return; + if (root == NULL) + return; DOMNodeList* children = root->getChildNodes(); for (size_t i = 0; i < children->getLength(); i++) { @@ -260,8 +260,8 @@ void DOMUtils::inPostFixOrder(const std::set<std::string>& elements, } std::list<DOMElement*> DOMUtils::inDocumentOrder(const std::set<std::string>& elements, - const DOMElement* root, - const bool includeEmbeddedDoc) { + const DOMElement* root, + const bool includeEmbeddedDoc) { std::list<DOMElement*> nodes; inDocumentOrder(elements, root, includeEmbeddedDoc, nodes); return nodes; @@ -271,10 +271,10 @@ void DOMUtils::inDocumentOrder(const std::set<std::string>& elements, const DOMElement* root, const bool includeEmbeddedDoc, std::list<DOMElement*>& nodes) { - if (root == NULL) - return; - - if (elements.find(TAGNAME(root)) != elements.end()) { + if (root == NULL) + return; + + if (elements.find(TAGNAME(root)) != elements.end()) { nodes.push_back((DOMElement*)root); } diff --git a/src/uscxml/util/DOM.h b/src/uscxml/util/DOM.h index 1f2ced2..0e8621c 100644 --- a/src/uscxml/util/DOM.h +++ b/src/uscxml/util/DOM.h @@ -24,6 +24,7 @@ #include <list> #include <iostream> +#include "uscxml/config.h" #include "uscxml/Common.h" #include <xercesc/util/XMLString.hpp> #include <xercesc/dom/DOM.hpp> @@ -58,57 +59,57 @@ namespace uscxml { class USCXML_API DOMUtils { public: - static const xercesc::DOMNode* getNearestAncestor(const xercesc::DOMNode* node, const std::string tagName); - static bool isDescendant(const xercesc::DOMNode* s1, const xercesc::DOMNode* s2); + static const XERCESC_NS::DOMNode* getNearestAncestor(const XERCESC_NS::DOMNode* node, const std::string tagName); + static bool isDescendant(const XERCESC_NS::DOMNode* s1, const XERCESC_NS::DOMNode* s2); - static bool hasIntersection(const std::list<xercesc::DOMElement*>& l1, - const std::list<xercesc::DOMElement*>& l2); - static bool isMember(const xercesc::DOMElement* node, const std::list<xercesc::DOMElement*>& list); - static bool isMember(const xercesc::DOMNode* node, const std::list<xercesc::DOMNode*>& list); - static bool isMember(const xercesc::DOMNode* node, const xercesc::DOMNodeList* list); + static bool hasIntersection(const std::list<XERCESC_NS::DOMElement*>& l1, + const std::list<XERCESC_NS::DOMElement*>& l2); + static bool isMember(const XERCESC_NS::DOMElement* node, const std::list<XERCESC_NS::DOMElement*>& list); + static bool isMember(const XERCESC_NS::DOMNode* node, const std::list<XERCESC_NS::DOMNode*>& list); + static bool isMember(const XERCESC_NS::DOMNode* node, const XERCESC_NS::DOMNodeList* list); - static std::string xPathForNode(const xercesc::DOMNode* node, + static std::string xPathForNode(const XERCESC_NS::DOMNode* node, const std::string& ns = ""); - static std::string idForNode(const xercesc::DOMNode* node); + static std::string idForNode(const XERCESC_NS::DOMNode* node); - static std::list<xercesc::DOMNode*> getElementsByType(const xercesc::DOMNode* root, - xercesc::DOMNode::NodeType type); + static std::list<XERCESC_NS::DOMNode*> getElementsByType(const XERCESC_NS::DOMNode* root, + XERCESC_NS::DOMNode::NodeType type); - static std::list<xercesc::DOMElement*> inPostFixOrder(const std::set<std::string>& elements, - const xercesc::DOMElement* root, + static std::list<XERCESC_NS::DOMElement*> inPostFixOrder(const std::set<std::string>& elements, + const XERCESC_NS::DOMElement* root, const bool includeEmbeddedDoc = false); - static std::list<xercesc::DOMElement*> inDocumentOrder(const std::set<std::string>& elements, - const xercesc::DOMElement* root, + static std::list<XERCESC_NS::DOMElement*> inDocumentOrder(const std::set<std::string>& elements, + const XERCESC_NS::DOMElement* root, const bool includeEmbeddedDoc = false); - static std::list<xercesc::DOMElement*> filterChildElements(const std::string& tagName, - const xercesc::DOMElement* node, + static std::list<XERCESC_NS::DOMElement*> filterChildElements(const std::string& tagName, + const XERCESC_NS::DOMElement* node, bool recurse = false); - static std::list<xercesc::DOMElement*> filterChildElements(const std::string& tagName, - const std::list<xercesc::DOMElement*>& nodeSet, + static std::list<XERCESC_NS::DOMElement*> filterChildElements(const std::string& tagName, + const std::list<XERCESC_NS::DOMElement*>& nodeSet, bool recurse = false); - static std::list<xercesc::DOMNode*> filterChildType(const xercesc::DOMNode::NodeType type, - const xercesc::DOMNode* node, + static std::list<XERCESC_NS::DOMNode*> filterChildType(const XERCESC_NS::DOMNode::NodeType type, + const XERCESC_NS::DOMNode* node, bool recurse = false); - static std::list<xercesc::DOMNode*> filterChildType(const xercesc::DOMNode::NodeType type, - const std::list<xercesc::DOMNode*>& nodeSet, + static std::list<XERCESC_NS::DOMNode*> filterChildType(const XERCESC_NS::DOMNode::NodeType type, + const std::list<XERCESC_NS::DOMNode*>& nodeSet, bool recurse = false); protected: static void inPostFixOrder(const std::set<std::string>& elements, - const xercesc::DOMElement* root, + const XERCESC_NS::DOMElement* root, const bool includeEmbeddedDoc, - std::list<xercesc::DOMElement*>& nodes); + std::list<XERCESC_NS::DOMElement*>& nodes); static void inDocumentOrder(const std::set<std::string>& elements, - const xercesc::DOMElement* root, + const XERCESC_NS::DOMElement* root, const bool includeEmbeddedDoc, - std::list<xercesc::DOMElement*>& nodes); + std::list<XERCESC_NS::DOMElement*>& nodes); }; @@ -121,21 +122,21 @@ public : X(X const &other) { _localForm = other._localForm; - _otherForm = xercesc::XMLString::replicate(other._otherForm); + _otherForm = XERCESC_NS::XMLString::replicate(other._otherForm); _deallocOther = true; } void operator=(X const &other) { // did we maybe leak before? _localForm = other._localForm; - _otherForm = xercesc::XMLString::replicate(other._otherForm); + _otherForm = XERCESC_NS::XMLString::replicate(other._otherForm); _deallocOther = true; } X(const XMLCh* const toTranscode) { if (toTranscode != NULL) { // Call the private transcoding method - char* tmp = xercesc::XMLString::transcode(toTranscode); + char* tmp = XERCESC_NS::XMLString::transcode(toTranscode); _localForm = std::string(tmp); - xercesc::XMLString::release(&tmp); + XERCESC_NS::XMLString::release(&tmp); } _otherForm = NULL; _deallocOther = false; @@ -144,21 +145,21 @@ public : X(const std::string& fromTranscode) { // Call the private transcoding method _localForm = fromTranscode; - _otherForm = xercesc::XMLString::transcode(fromTranscode.c_str()); + _otherForm = XERCESC_NS::XMLString::transcode(fromTranscode.c_str()); _deallocOther = true; } X(const char* const fromTranscode) { // Call the private transcoding method _localForm = fromTranscode; - _otherForm = xercesc::XMLString::transcode(fromTranscode); + _otherForm = XERCESC_NS::XMLString::transcode(fromTranscode); _deallocOther = true; } X(char* fromTranscode) { // Call the private transcoding method _localForm = fromTranscode; - _otherForm = xercesc::XMLString::transcode(fromTranscode); + _otherForm = XERCESC_NS::XMLString::transcode(fromTranscode); _deallocOther = true; } @@ -169,7 +170,7 @@ public : ~X() { if (_deallocOther) - xercesc::XMLString::release(&_otherForm); + XERCESC_NS::XMLString::release(&_otherForm); } const std::string& str() const { @@ -199,7 +200,7 @@ private: }; USCXML_API std::ostream& operator<< (std::ostream& os, const X& xmlString); -USCXML_API std::ostream& operator<< (std::ostream& os, const xercesc::DOMNode& node); +USCXML_API std::ostream& operator<< (std::ostream& os, const XERCESC_NS::DOMNode& node); } diff --git a/src/uscxml/util/Predicates.cpp b/src/uscxml/util/Predicates.cpp index 6ac092f..2f46d75 100644 --- a/src/uscxml/util/Predicates.cpp +++ b/src/uscxml/util/Predicates.cpp @@ -22,7 +22,7 @@ namespace uscxml { -using namespace xercesc; +using namespace XERCESC_NS; std::list<DOMElement*> getChildStates(const DOMElement* state, bool properOnly) { std::list<DOMElement*> children; @@ -39,8 +39,8 @@ std::list<DOMElement*> getChildStates(const DOMElement* state, bool properOnly) return children; } -std::list<xercesc::DOMElement*> getChildStates(const std::list<xercesc::DOMElement*>& states, bool properOnly) { - std::list<xercesc::DOMElement*> children; +std::list<XERCESC_NS::DOMElement*> getChildStates(const std::list<XERCESC_NS::DOMElement*>& states, bool properOnly) { + std::list<XERCESC_NS::DOMElement*> children; for (auto stateIter = states.begin(); stateIter != states.end(); stateIter++) { std::list<DOMElement*> tmp = getChildStates(*stateIter, properOnly); children.merge(tmp); diff --git a/src/uscxml/util/Predicates.h b/src/uscxml/util/Predicates.h index 50c69b6..7bc4a9c 100644 --- a/src/uscxml/util/Predicates.h +++ b/src/uscxml/util/Predicates.h @@ -28,32 +28,32 @@ namespace uscxml { -std::list<xercesc::DOMElement*> getChildStates(const xercesc::DOMElement* state, bool properOnly = true); -std::list<xercesc::DOMElement*> getChildStates(const std::list<xercesc::DOMElement*>& states, bool properOnly = true); -xercesc::DOMElement* getParentState(const xercesc::DOMElement* element); -xercesc::DOMElement* getSourceState(const xercesc::DOMElement* transition); -xercesc::DOMElement* findLCCA(const std::list<xercesc::DOMElement*>& states); -std::list<xercesc::DOMElement*> getProperAncestors(const xercesc::DOMElement* s1, const xercesc::DOMElement* s2); - -std::list<xercesc::DOMElement*> getTargetStates(const xercesc::DOMElement* transition, const xercesc::DOMElement* root); -std::list<xercesc::DOMElement*> getEffectiveTargetStates(const xercesc::DOMElement* transition); -xercesc::DOMElement* getTransitionDomain(const xercesc::DOMElement* transition, const xercesc::DOMElement* root); - -bool isInEmbeddedDocument(const xercesc::DOMNode* node); - -std::list<xercesc::DOMElement*> getStates(const std::list<std::string>& stateIds, const xercesc::DOMElement* root); -xercesc::DOMElement* getState(const std::string& stateId, const xercesc::DOMElement* root); -std::list<xercesc::DOMElement*> getInitialStates(const xercesc::DOMElement* state, const xercesc::DOMElement* root); -std::list<xercesc::DOMElement*> getReachableStates(const xercesc::DOMElement* root); -std::list<xercesc::DOMElement*> getExitSet(const xercesc::DOMElement* transition, const xercesc::DOMElement* root); -bool conflicts(const xercesc::DOMElement* transition1, const xercesc::DOMElement* transition2, const xercesc::DOMElement* root); - -bool isState(const xercesc::DOMElement* state, bool properOnly = true); -bool isCompound(const xercesc::DOMElement* state); -bool isAtomic(const xercesc::DOMElement* state); -bool isParallel(const xercesc::DOMElement* state); -bool isFinal(const xercesc::DOMElement* state); -bool isHistory(const xercesc::DOMElement* state); +std::list<XERCESC_NS::DOMElement*> getChildStates(const XERCESC_NS::DOMElement* state, bool properOnly = true); +std::list<XERCESC_NS::DOMElement*> getChildStates(const std::list<XERCESC_NS::DOMElement*>& states, bool properOnly = true); +XERCESC_NS::DOMElement* getParentState(const XERCESC_NS::DOMElement* element); +XERCESC_NS::DOMElement* getSourceState(const XERCESC_NS::DOMElement* transition); +XERCESC_NS::DOMElement* findLCCA(const std::list<XERCESC_NS::DOMElement*>& states); +std::list<XERCESC_NS::DOMElement*> getProperAncestors(const XERCESC_NS::DOMElement* s1, const XERCESC_NS::DOMElement* s2); + +std::list<XERCESC_NS::DOMElement*> getTargetStates(const XERCESC_NS::DOMElement* transition, const XERCESC_NS::DOMElement* root); +std::list<XERCESC_NS::DOMElement*> getEffectiveTargetStates(const XERCESC_NS::DOMElement* transition); +XERCESC_NS::DOMElement* getTransitionDomain(const XERCESC_NS::DOMElement* transition, const XERCESC_NS::DOMElement* root); + +bool isInEmbeddedDocument(const XERCESC_NS::DOMNode* node); + +std::list<XERCESC_NS::DOMElement*> getStates(const std::list<std::string>& stateIds, const XERCESC_NS::DOMElement* root); +XERCESC_NS::DOMElement* getState(const std::string& stateId, const XERCESC_NS::DOMElement* root); +std::list<XERCESC_NS::DOMElement*> getInitialStates(const XERCESC_NS::DOMElement* state, const XERCESC_NS::DOMElement* root); +std::list<XERCESC_NS::DOMElement*> getReachableStates(const XERCESC_NS::DOMElement* root); +std::list<XERCESC_NS::DOMElement*> getExitSet(const XERCESC_NS::DOMElement* transition, const XERCESC_NS::DOMElement* root); +bool conflicts(const XERCESC_NS::DOMElement* transition1, const XERCESC_NS::DOMElement* transition2, const XERCESC_NS::DOMElement* root); + +bool isState(const XERCESC_NS::DOMElement* state, bool properOnly = true); +bool isCompound(const XERCESC_NS::DOMElement* state); +bool isAtomic(const XERCESC_NS::DOMElement* state); +bool isParallel(const XERCESC_NS::DOMElement* state); +bool isFinal(const XERCESC_NS::DOMElement* state); +bool isHistory(const XERCESC_NS::DOMElement* state); } diff --git a/src/uscxml/util/URL.cpp b/src/uscxml/util/URL.cpp index a576f8b..cb3abe3 100644 --- a/src/uscxml/util/URL.cpp +++ b/src/uscxml/util/URL.cpp @@ -140,7 +140,7 @@ URL URLImpl::resolveWithCWD(URLImpl* relative) { } currPath[sizeof(currPath) - 1] = '\0'; /* not really required? */ - // without the trailing slash, last component is assumed a file + // without the trailing slash, last component is assumed a file std::shared_ptr<URLImpl> cwdURL(new URLImpl(std::string("file://") + currPath + PATH_SEPERATOR)); return resolve(relative, cwdURL.get()); diff --git a/src/uscxml/util/URL.h b/src/uscxml/util/URL.h index f545fe8..dba8e3d 100644 --- a/src/uscxml/util/URL.h +++ b/src/uscxml/util/URL.h @@ -190,7 +190,8 @@ protected: class USCXML_API URL { public: - PIMPL_OPERATORS(URL) + PIMPL_OPERATORS(URL); + URL(const std::string url) : _impl(new URLImpl(url)) {} bool isAbsolute() { diff --git a/src/uscxml/util/UUID.cpp b/src/uscxml/util/UUID.cpp index 34e3e75..6f7cf96 100644 --- a/src/uscxml/util/UUID.cpp +++ b/src/uscxml/util/UUID.cpp @@ -17,12 +17,16 @@ * @endcond */ -#include "UUID.h" #include <sstream> #include <boost/uuid/uuid_io.hpp> +#include <boost/uuid/random_generator.hpp> + +#include "UUID.h" namespace uscxml { -boost::uuids::random_generator UUID::uuidGen; + +// hide from public header +boost::uuids::random_generator uuidGen; std::string UUID::getUUID() { boost::uuids::uuid uuid = uuidGen(); diff --git a/src/uscxml/util/UUID.h b/src/uscxml/util/UUID.h index 873d963..bc362c0 100644 --- a/src/uscxml/util/UUID.h +++ b/src/uscxml/util/UUID.h @@ -21,7 +21,6 @@ #define UUID_H_8X65R2EI #include "uscxml/Common.h" -#include <boost/uuid/uuid_generators.hpp> #include <string> namespace uscxml { @@ -30,7 +29,6 @@ class USCXML_API UUID { public: static std::string getUUID(); static bool isUUID(const std::string& uuid); - static boost::uuids::random_generator uuidGen; }; } |