diff options
Diffstat (limited to 'src/uscxml/plugins/datamodel')
7 files changed, 42 insertions, 26 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index d43efbe..35d9c4b 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -43,12 +43,12 @@ if (exception) \ handleException(exception); -using namespace xercesc; +using namespace XERCESC_NS; static JSValueRef XMLString2JS(const XMLCh* input, JSContextRef context) { JSValueRef output; - char* res = xercesc::XMLString::transcode(input); + char* res = XERCESC_NS::XMLString::transcode(input); JSStringRef stringRef = JSStringCreateWithUTF8CString(res); output = JSValueMakeString(context, stringRef); @@ -70,7 +70,7 @@ static XMLCh* JS2XMLString(JSValueRef input, JSContextRef context) { char* output = new char[maxSize + 1]; JSStringGetUTF8CString(stringInput, output, maxSize); - XMLCh* ret = xercesc::XMLString::transcode(output); + XMLCh* ret = XERCESC_NS::XMLString::transcode(output); return(ret); } @@ -509,7 +509,7 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) { // dom node void* privData = NULL; SWIG_JSC_ConvertPtr(_ctx, value, &privData, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0); - data.node = (xercesc::DOMNode*)privData; + data.node = (XERCESC_NS::DOMNode*)privData; return data; } std::set<std::string> propertySet; diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h index b65dc37..c5129a4 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h @@ -21,14 +21,10 @@ #define JSCDATAMODEL_H_KN8TWG0V #include "uscxml/config.h" -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <list> #include <set> -/** - * There are two variants with JavaScriptCore headers - * Still beats the >20 V8 variants =D - */ #if defined(HAS_JSC_JAVASCRIPTCORE_H) #include <JavaScriptCore/JavaScriptCore.h> #elif defined(HAS_JSC_JAVASCRIPT_H) @@ -48,6 +44,11 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * + * ECMAScript data-model via JavaScriptCore. + */ class JSCDataModel : public DataModelImpl { public: JSCDataModel(); @@ -103,7 +104,7 @@ protected: static JSValueRef jsInvokerGetProp(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static void jsInvokerListProps(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); - JSValueRef getNodeAsValue(const xercesc::DOMNode* node); + JSValueRef getNodeAsValue(const XERCESC_NS::DOMNode* node); JSValueRef getDataAsValue(const Data& data); Data getValueAsData(const JSValueRef value); JSValueRef evalAsValue(const std::string& expr, bool dontThrow = false); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index bfa29d8..3ccadcd 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -33,17 +33,17 @@ #include "uscxml/util/DOM.h" #include <easylogging++.h> -using namespace xercesc; +using namespace XERCESC_NS; static v8::Local<v8::Value> XMLString2JS(const XMLCh* input) { - char* res = xercesc::XMLString::transcode(input); + char* res = XERCESC_NS::XMLString::transcode(input); v8::Local<v8::Value> handle = v8::String::New(res); return handle; } static XMLCh* JS2XMLString(const v8::Local<v8::Value>& value) { v8::String::AsciiValue s(value); - XMLCh* ret = xercesc::XMLString::transcode(*s); + XMLCh* ret = XERCESC_NS::XMLString::transcode(*s); return(ret); } @@ -137,11 +137,11 @@ std::mutex V8DataModel::_initMutex; v8::Isolate* V8DataModel::_isolate = NULL; void V8NodeListIndexedPropertyHandler(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { - xercesc::DOMNodeList* list; + XERCESC_NS::DOMNodeList* list; SWIG_V8_GetInstancePtr(info.Holder(), (void**)&list); if (list->getLength() >= index) { - xercesc::DOMNode* node = list->item(index); + XERCESC_NS::DOMNode* node = list->item(index); v8::Handle<v8::Value> val = SWIG_NewPointerObj(SWIG_as_voidptr(node), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), 0 | 0 ); info.GetReturnValue().Set(val); @@ -528,7 +528,7 @@ Data V8DataModel::getValueAsData(const v8::Local<v8::Value>& value, std::set<v8: return data; } -v8::Local<v8::Value> V8DataModel::getNodeAsValue(const xercesc::DOMNode* node) { +v8::Local<v8::Value> V8DataModel::getNodeAsValue(const XERCESC_NS::DOMNode* node) { return SWIG_NewPointerObj(SWIG_as_voidptr(node), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h index 29b2b58..91ac48d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h @@ -20,7 +20,8 @@ #ifndef V8DATAMODEL_H_KN8TWG0V #define V8DATAMODEL_H_KN8TWG0V -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" + #include <list> #include <set> #include <v8.h> @@ -36,6 +37,11 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * ECMAScript data-model via Google's V8. + */ + class V8DataModel : public DataModelImpl { public: V8DataModel(); @@ -95,7 +101,7 @@ protected: v8::Local<v8::Value> evalAsValue(const std::string& expr, bool dontThrow = false); v8::Local<v8::Value> getDataAsValue(const Data& data); Data getValueAsData(const v8::Local<v8::Value>& value); - v8::Local<v8::Value> getNodeAsValue(const xercesc::DOMNode* node); + v8::Local<v8::Value> getNodeAsValue(const XERCESC_NS::DOMNode* node); void throwExceptionEvent(const v8::TryCatch& tryCatch); std::set<DataModelExtension*> _extensions; diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h index 4e2fd43..7b7121f 100644 --- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h +++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h @@ -20,7 +20,7 @@ #ifndef LUADATAMODEL_H_113E014C #define LUADATAMODEL_H_113E014C -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <list> extern "C" { @@ -41,6 +41,11 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * Lua data-model. + */ + class LuaDataModel : public DataModelImpl { public: LuaDataModel(); diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp index 773a970..53c414f 100644 --- a/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp +++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.cpp @@ -63,7 +63,7 @@ Data NULLDataModel::getAsData(const std::string& content) { * The predicate must return 'true' if and only if that state is in the current * state configuration. */ -bool NULLDataModel::evalAsBool(const xercesc::DOMElement* scriptNode, const std::string& expr) { +bool NULLDataModel::evalAsBool(const XERCESC_NS::DOMElement* scriptNode, const std::string& expr) { std::string trimmedExpr = expr; boost::trim(trimmedExpr); if (!boost::istarts_with(trimmedExpr, "in")) diff --git a/src/uscxml/plugins/datamodel/null/NULLDataModel.h b/src/uscxml/plugins/datamodel/null/NULLDataModel.h index c584357..4bea664 100644 --- a/src/uscxml/plugins/datamodel/null/NULLDataModel.h +++ b/src/uscxml/plugins/datamodel/null/NULLDataModel.h @@ -20,7 +20,7 @@ #ifndef NULLDATAMODEL_H_KN8TWG0V #define NULLDATAMODEL_H_KN8TWG0V -#include "uscxml/plugins/DataModel.h" +#include "uscxml/plugins/DataModelImpl.h" #include <list> #ifdef BUILD_AS_PLUGINS @@ -34,6 +34,10 @@ class Data; namespace uscxml { +/** + * @ingroup datamodel + * NULL data-model. + */ class NULLDataModel : public DataModelImpl { public: NULLDataModel(); @@ -76,7 +80,7 @@ public: return expr; } - virtual bool evalAsBool(const xercesc::DOMElement* scriptNode, + virtual bool evalAsBool(const XERCESC_NS::DOMElement* scriptNode, const std::string& expr); virtual bool evalAsBool(const std::string& expr) { return evalAsBool(NULL, expr); @@ -86,13 +90,13 @@ public: return true; } - virtual void assign(const xercesc::DOMElement* assignElem, - const xercesc::DOMNode* node, + virtual void assign(const XERCESC_NS::DOMElement* assignElem, + const XERCESC_NS::DOMNode* node, const std::string& content) {} virtual void assign(const std::string& location, const Data& data) {} - virtual void init(const xercesc::DOMElement* dataElem, - const xercesc::DOMNode* node, + virtual void init(const XERCESC_NS::DOMElement* dataElem, + const XERCESC_NS::DOMNode* node, const std::string& content) {} virtual void init(const std::string& location, const Data& data) {} |