summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/swig/php/uscxmlNativePHP.php6
-rw-r--r--src/uscxml/Common.h2
-rw-r--r--src/uscxml/Factory.cpp42
-rw-r--r--src/uscxml/Factory.h14
-rw-r--r--src/uscxml/Interpreter.cpp15
-rw-r--r--src/uscxml/Interpreter.h8
-rw-r--r--src/uscxml/Message.cpp23
-rw-r--r--src/uscxml/Message.h3
-rw-r--r--src/uscxml/NameSpacingParser.cpp64
-rw-r--r--src/uscxml/NameSpacingParser.h32
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp2
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp84
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h88
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp144
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h106
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp558
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h170
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp112
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h98
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp418
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h158
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp42
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h80
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp12
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp258
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp558
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h250
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp54
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h58
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h82
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp32
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h56
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h58
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp108
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h120
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h50
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp104
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h108
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp76
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h2
-rw-r--r--src/uscxml/plugins/element/mmi/MMIEvents.cpp74
-rw-r--r--src/uscxml/plugins/element/mmi/MMIEvents.h2
-rw-r--r--src/uscxml/plugins/invoker/CMakeLists.txt17
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp4
-rw-r--r--src/uscxml/plugins/invoker/http/HTTPServletInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp6
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp195
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h55
-rw-r--r--src/uscxml/plugins/ioprocessor/CMakeLists.txt31
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp5
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h2
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp94
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h53
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp5
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h62
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp123
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.h90
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp8
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h2
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp41
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h39
-rw-r--r--src/uscxml/server/HTTPServer.cpp56
-rw-r--r--src/uscxml/server/HTTPServer.h15
-rw-r--r--src/uscxml/server/InterpreterServlet.cpp3
-rw-r--r--src/uscxml/server/InterpreterServlet.h2
79 files changed, 3223 insertions, 2640 deletions
diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php
index 7d8b0aa..b16f074 100644
--- a/src/bindings/swig/php/uscxmlNativePHP.php
+++ b/src/bindings/swig/php/uscxmlNativePHP.php
@@ -2,7 +2,7 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.9
+ * Version 2.0.7
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -284,6 +284,10 @@ class Data {
return $r;
}
+ static function toJSON($data) {
+ return Data_toJSON($data);
+ }
+
static function fromXML($xmlString) {
$r=Data_fromXML($xmlString);
if (is_resource($r)) {
diff --git a/src/uscxml/Common.h b/src/uscxml/Common.h
index 5840d97..279306a 100644
--- a/src/uscxml/Common.h
+++ b/src/uscxml/Common.h
@@ -3,6 +3,8 @@
#ifdef _WIN32
#include <winsock2.h>
+// see http://stackoverflow.com/questions/1372480/c-redefinition-header-files
+#define _WINSOCKAPI_ // stops windows.h including winsock.h
#include <windows.h>
#else
#include <sys/socket.h>
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index cc7eeb3..a13a887 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -6,17 +6,21 @@
#include "uscxml/Interpreter.h"
#include <glog/logging.h>
+// see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
+
#ifdef BUILD_AS_PLUGINS
# include "uscxml/plugins/Plugins.h"
#else
# include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
+# include "uscxml/plugins/ioprocessor/comet/CometIOProcessor.h"
# include "uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.h"
# include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h"
# include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
# include "uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h"
# include "uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h"
# include "uscxml/plugins/invoker/system/SystemInvoker.h"
+# include "uscxml/plugins/invoker/xhtml/XHTMLInvoker.h"
#ifdef PROTOBUF_FOUND
# include "uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h"
@@ -148,21 +152,21 @@ Factory::Factory() {
}
#endif
-#if defined V8_FOUND and defined BUILD_DM_ECMA
+#if (defined V8_FOUND && defined BUILD_DM_ECMA)
{
V8DataModel* dataModel = new V8DataModel();
registerDataModel(dataModel);
}
#endif
-#if defined JSC_FOUND and defined BUILD_DM_ECMA
+#if (defined JSC_FOUND && defined BUILD_DM_ECMA)
{
JSCDataModel* dataModel = new JSCDataModel();
registerDataModel(dataModel);
}
#endif
-#if defined SWI_FOUND and defined BUILD_DM_PROLOG
+#if (defined SWI_FOUND && defined BUILD_DM_PROLOG)
{
SWIDataModel* dataModel = new SWIDataModel();
registerDataModel(dataModel);
@@ -177,10 +181,10 @@ Factory::Factory() {
#endif
#ifdef PROTOBUF_FOUND
- {
- MMIHTTPIOProcessor* ioProcessor = new MMIHTTPIOProcessor();
- registerIOProcessor(ioProcessor);
- }
+ {
+ MMIHTTPIOProcessor* ioProcessor = new MMIHTTPIOProcessor();
+ registerIOProcessor(ioProcessor);
+ }
#endif
// these are always available
@@ -189,6 +193,10 @@ Factory::Factory() {
registerDataModel(dataModel);
}
{
+ XHTMLInvoker* invoker = new XHTMLInvoker();
+ registerInvoker(invoker);
+ }
+ {
USCXMLInvoker* invoker = new USCXMLInvoker();
registerInvoker(invoker);
}
@@ -232,7 +240,7 @@ Factory::Factory() {
PostponeElement* element = new PostponeElement();
registerExecutableContent(element);
}
-
+
#endif
}
@@ -292,18 +300,18 @@ std::map<std::string, IOProcessorImpl*> Factory::getIOProcessors() {
if (_parentFactory) {
ioProcs = _parentFactory->getIOProcessors();
}
-
+
std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = _ioProcessors.begin();
while(ioProcIter != _ioProcessors.end()) {
ioProcs.insert(std::make_pair(ioProcIter->first, ioProcIter->second));
ioProcIter++;
}
-
+
return ioProcs;
}
boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, InterpreterImpl* interpreter) {
-
+
// do we have this type ourself?
if (_invokerAliases.find(type) != _invokerAliases.end()) {
std::string canonicalName = _invokerAliases[type];
@@ -318,12 +326,12 @@ boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, I
} else {
LOG(ERROR) << "No " << type << " Invoker known";
}
-
+
return boost::shared_ptr<InvokerImpl>();
}
boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& type, InterpreterImpl* interpreter) {
-
+
// do we have this type ourself?
if (_dataModelAliases.find(type) != _dataModelAliases.end()) {
std::string canonicalName = _dataModelAliases[type];
@@ -331,14 +339,14 @@ boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& typ
return _dataModels[canonicalName]->create(interpreter);
}
}
-
+
// lookup in parent factory
if (_parentFactory) {
return _parentFactory->createDataModel(type, interpreter);
} else {
LOG(ERROR) << "No " << type << " Datamodel known";
}
-
+
return boost::shared_ptr<DataModelImpl>();
}
@@ -350,14 +358,14 @@ boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string&
return _ioProcessors[canonicalName]->create(interpreter);
}
}
-
+
// lookup in parent factory
if (_parentFactory) {
return _parentFactory->createIOProcessor(type, interpreter);
} else {
LOG(ERROR) << "No " << type << " Datamodel known";
}
-
+
return boost::shared_ptr<IOProcessorImpl>();
}
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h
index d92d105..b3bfded 100644
--- a/src/uscxml/Factory.h
+++ b/src/uscxml/Factory.h
@@ -116,13 +116,13 @@ public:
void setType(const std::string& type) {
_type = type;
}
-
+
virtual Data getDataModelVariables() = 0;
virtual void send(const SendRequest& req) = 0;
-
+
virtual void runOnMainThread() {};
void returnEvent(Event& event);
-
+
protected:
InterpreterImpl* _interpreter;
std::string _invokeId;
@@ -136,11 +136,11 @@ public:
EventHandler(boost::shared_ptr<EventHandlerImpl> const impl) : _impl(impl) { }
EventHandler(const EventHandler& other) : _impl(other._impl) { }
virtual ~EventHandler() {};
-
+
virtual std::set<std::string> getNames() {
return _impl->getNames();
}
-
+
virtual Data getDataModelVariables() const {
return _impl->getDataModelVariables();
};
@@ -150,7 +150,7 @@ public:
virtual void runOnMainThread() {
return _impl->runOnMainThread();
}
-
+
void setInterpreter(InterpreterImpl* interpreter) {
_impl->setInterpreter(interpreter);
}
@@ -382,7 +382,7 @@ public:
boost::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter);
std::map<std::string, IOProcessorImpl*> getIOProcessors();
-
+
static Factory* getInstance();
std::map<std::string, DataModelImpl*> _dataModels;
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 8bb6499..bdda8c8 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -133,16 +133,19 @@ Interpreter Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string>&
tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
boost::shared_ptr<InterpreterDraft6> interpreterImpl = boost::shared_ptr<InterpreterDraft6>(new InterpreterDraft6);
Interpreter interpreter;
- NameSpacingParser* parser = new NameSpacingParser();
- if (parser->parse(source) && parser->getDocument() && parser->getDocument().hasChildNodes()) {
- interpreterImpl->setNameSpaceInfo(parser->nameSpace);
- interpreterImpl->_document = parser->getDocument();
+ NameSpacingParser parser;
+ if (parser.parse(source) && parser.getDocument() && parser.getDocument().hasChildNodes()) {
+ interpreterImpl->setNameSpaceInfo(parser.nameSpace);
+ interpreterImpl->_document = parser.getDocument();
interpreterImpl->init();
interpreter = Interpreter(interpreterImpl);
_instances[interpreterImpl->getSessionId()] = interpreterImpl;
+ } else {
+ if (parser.errorsReported()) {
+ LOG(ERROR) << parser.errors();
+ }
}
// interpreter->init();
- delete parser;
return interpreter;
}
@@ -260,7 +263,7 @@ void InterpreterImpl::init() {
if (_factory == NULL)
_factory = Factory::getInstance();
-
+
} else {
LOG(ERROR) << "Cannot find SCXML element" << std::endl;
_done = true;
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 7c95426..7de6c63 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -135,8 +135,10 @@ public:
return "";
}
void setNameSpaceInfo(const std::map<std::string, std::string> nameSpaceInfo);
- std::map<std::string, std::string> getNameSpaceInfo() { return _nameSpaceInfo; }
-
+ std::map<std::string, std::string> getNameSpaceInfo() {
+ return _nameSpaceInfo;
+ }
+
void receiveInternal(const Event& event);
void receive(const Event& event, bool toFront = false);
@@ -391,7 +393,7 @@ public:
std::map<std::string, std::string> getNameSpaceInfo() {
return _impl->getNameSpaceInfo();
}
-
+
void setCmdLineOptions(int argc, char** argv) {
return _impl->setCmdLineOptions(argc, argv);
}
diff --git a/src/uscxml/Message.cpp b/src/uscxml/Message.cpp
index 2425c76..2e82b69 100644
--- a/src/uscxml/Message.cpp
+++ b/src/uscxml/Message.cpp
@@ -276,6 +276,8 @@ Data Data::fromJSON(const std::string& jsonString) {
size_t currTok = 0;
do {
+ jsmntok_t t2 = t[currTok];
+ std::string value = trimmed.substr(t[currTok].start, t[currTok].end - t[currTok].start);
switch (t[currTok].type) {
case JSMN_STRING:
dataStack.back()->type = Data::VERBATIM;
@@ -291,13 +293,18 @@ Data Data::fromJSON(const std::string& jsonString) {
break;
}
+ t2 = t[currTok];
+ value = trimmed.substr(t[currTok].start, t[currTok].end - t[currTok].start);
+
// there are no more tokens
if (t[currTok].end == 0 || tokenStack.empty())
break;
// next token starts after current one => pop
- if (t[currTok].end > tokenStack.back().end)
+ if (t[currTok].end > tokenStack.back().end) {
tokenStack.pop_back();
+ dataStack.pop_back();
+ }
if (tokenStack.back().type == JSMN_OBJECT && (t[currTok].type == JSMN_PRIMITIVE || t[currTok].type == JSMN_STRING)) {
// grab key and push new data
@@ -328,7 +335,7 @@ void Event::initContent(const std::string& content) {
Arabica::SAX2DOM::Parser<std::string> parser;
Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
parser.setErrorHandler(errorHandler);
-
+
std::istringstream is(content);
Arabica::SAX::InputSource<std::string> inputSource;
inputSource.setByteStream(is);
@@ -336,7 +343,7 @@ void Event::initContent(const std::string& content) {
dom = parser.getDocument();
return;
}
-
+
this->content = content;
}
@@ -513,6 +520,13 @@ std::ostream& operator<< (std::ostream& os, const Event& event) {
#ifndef SWIGJAVA
std::ostream& operator<< (std::ostream& os, const Data& data) {
+ os << Data::toJSON(data);
+ return os;
+}
+#endif
+
+std::string Data::toJSON(const Data& data) {
+ std::stringstream os;
std::string indent;
for (int i = 0; i < _dataIndentation; i++) {
indent += " ";
@@ -564,8 +578,7 @@ std::ostream& operator<< (std::ostream& os, const Data& data) {
} else {
os << "undefined";
}
- return os;
+ return os.str();
}
-#endif
} \ No newline at end of file
diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h
index 0f82947..dd62702 100644
--- a/src/uscxml/Message.h
+++ b/src/uscxml/Message.h
@@ -42,7 +42,7 @@ public:
const Data operator[](const std::string& key) const {
return operator[](key.c_str());
}
-
+
const Data operator[](const char* key) const {
if (hasKey(key))
return compound.at(key);
@@ -63,6 +63,7 @@ public:
}
static Data fromJSON(const std::string& jsonString);
+ static std::string toJSON(const Data& data);
static Data fromXML(const std::string& xmlString);
Arabica::DOM::Document<std::string> toDocument();
std::string toXMLString() {
diff --git a/src/uscxml/NameSpacingParser.cpp b/src/uscxml/NameSpacingParser.cpp
index 21d9704..619d62c 100644
--- a/src/uscxml/NameSpacingParser.cpp
+++ b/src/uscxml/NameSpacingParser.cpp
@@ -1,44 +1,42 @@
+#include <uscxml/Common.h>
#include "NameSpacingParser.h"
#include <glog/logging.h>
+#include <SAX/helpers/InputSourceResolver.hpp>
namespace uscxml {
-
- NameSpacingParser* NameSpacingParser::fromXML(const std::string& xml) {
- if (xml.length() == 0)
- return NULL;
- std::stringstream* ss = new std::stringstream();
- (*ss) << xml;
- // we need an auto_ptr for arabica to assume ownership
- std::auto_ptr<std::istream> ssPtr(ss);
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setByteStream(ssPtr);
- return fromInputSource(inputSource);
- }
- NameSpacingParser* NameSpacingParser::fromInputSource(Arabica::SAX::InputSource<std::string>& source) {
- NameSpacingParser* parser = new NameSpacingParser();
- if(!parser->parse(source) || !parser->getDocument().hasChildNodes()) {
- if(parser->_errorHandler.errorsReported()) {
- LOG(ERROR) << "could not parse input:";
- LOG(ERROR) << parser->_errorHandler.errors() << std::endl;
- } else {
- Arabica::SAX::InputSourceResolver resolver(source, Arabica::default_string_adaptor<std::string>());
- if (!resolver.resolve()) {
- LOG(ERROR) << source.getSystemId() << ": no such file";
- }
+NameSpacingParser NameSpacingParser::fromXML(const std::string& xml) {
+ std::stringstream* ss = new std::stringstream();
+ (*ss) << xml;
+ // we need an auto_ptr for arabica to assume ownership
+ std::auto_ptr<std::istream> ssPtr(ss);
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setByteStream(ssPtr);
+ return fromInputSource(inputSource);
+}
+
+NameSpacingParser NameSpacingParser::fromInputSource(Arabica::SAX::InputSource<std::string>& source) {
+ NameSpacingParser parser;
+ if(!parser.parse(source) || !parser.getDocument().hasChildNodes()) {
+ if(parser._errorHandler.errorsReported()) {
+ LOG(ERROR) << "could not parse input:";
+ LOG(ERROR) << parser._errorHandler.errors() << std::endl;
+ } else {
+ Arabica::SAX::InputSourceResolver resolver(source, Arabica::default_string_adaptor<std::string>());
+ if (!resolver.resolve()) {
+ LOG(ERROR) << source.getSystemId() << ": no such file";
}
- delete parser;
}
- return parser;
}
+ return parser;
+}
- NameSpacingParser::NameSpacingParser() {
- Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
- setErrorHandler(errorHandler);
- }
-
- void NameSpacingParser::startPrefixMapping(const std::string& prefix, const std::string& uri) {
- nameSpace.insert(std::make_pair(uri, prefix));
- }
+NameSpacingParser::NameSpacingParser() {
+ setErrorHandler(_errorHandler);
+}
+
+void NameSpacingParser::startPrefixMapping(const std::string& prefix, const std::string& uri) {
+ nameSpace.insert(std::make_pair(uri, prefix));
+}
} \ No newline at end of file
diff --git a/src/uscxml/NameSpacingParser.h b/src/uscxml/NameSpacingParser.h
index 7dcefcf..fddf306 100644
--- a/src/uscxml/NameSpacingParser.h
+++ b/src/uscxml/NameSpacingParser.h
@@ -5,21 +5,29 @@
#include <SAX/helpers/CatchErrorHandler.hpp>
namespace uscxml {
-
- class NameSpacingParser : public Arabica::SAX2DOM::Parser<std::string> {
- public:
- NameSpacingParser();
- static NameSpacingParser* fromXML(const std::string& xml);
- static NameSpacingParser* fromInputSource(Arabica::SAX::InputSource<std::string>& source);
- void startPrefixMapping(const std::string& prefix, const std::string& uri);
+class NameSpacingParser : public Arabica::SAX2DOM::Parser<std::string> {
+public:
+ NameSpacingParser();
+ static NameSpacingParser fromXML(const std::string& xml);
+ static NameSpacingParser fromInputSource(Arabica::SAX::InputSource<std::string>& source);
- Arabica::SAX::CatchErrorHandler<std::string> _errorHandler;
- std::map<std::string, std::string> nameSpace;
+ void startPrefixMapping(const std::string& prefix, const std::string& uri);
- private:
- NameSpacingParser(const NameSpacingParser& other) {}
- };
+ std::map<std::string, std::string> nameSpace;
+
+ virtual bool errorsReported() {
+ return _errorHandler.errorsReported();
+ }
+
+ virtual const std::string& errors() {
+ return _errorHandler.errors();
+ }
+
+private:
+ Arabica::SAX::CatchErrorHandler<std::string> _errorHandler;
+ NameSpacingParser(const NameSpacingParser& other) {}
+};
}
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index fb6a637..915eba5 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -15,7 +15,7 @@ void InterpreterDraft6::interpret() {
init();
// std::cout << _scxml << std::endl;
-
+
if (!_scxml) {
// _mutex.unlock();
return;
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
index d16f81b..bee6042 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
@@ -5,59 +5,59 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
- v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getName().c_str());
- }
+ return v8::String::New(privData->nativeObj->getName().c_str());
+}
- v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->getSpecified());
- }
+ return v8::Boolean::New(privData->nativeObj->getSpecified());
+}
- v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getValue().c_str());
- }
+ return v8::String::New(privData->nativeObj->getValue().c_str());
+}
- void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localValue(value);
- privData->nativeObj->setValue(*localValue);
- }
+void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localValue(value);
+ privData->nativeObj->setValue(*localValue);
+}
- v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getOwnerElement()) return v8::Undefined();
- Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
+ if (!privData->nativeObj->getOwnerElement()) return v8::Undefined();
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- }
- bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
-}
-}
+}
+bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
index e317698..9829023 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
@@ -33,50 +33,50 @@ namespace DOM {
class V8Attr {
public:
- struct V8AttrPrivate {
- V8DOM* dom;
- Arabica::DOM::Attr<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8AttrPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Attr"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8AttrPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Attr<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8AttrPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Attr"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
index 90495f4..a9e5ac9 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
- bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
index f9767a0..3b95b84 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8CDATASection {
public:
- struct V8CDATASectionPrivate {
- V8DOM* dom;
- Arabica::DOM::CDATASection<std::string>* nativeObj;
- };
+ struct V8CDATASectionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CDATASection<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8CDATASectionPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8CDATASectionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("CDATASection"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CDATASection"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8Text::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8Text::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
index 74c80ea..459cf96 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
@@ -4,102 +4,102 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
- v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getData().c_str());
- }
+ return v8::String::New(privData->nativeObj->getData().c_str());
+}
- void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(value);
- privData->nativeObj->setData(*localData);
- }
+void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->nativeObj->setData(*localData);
+}
- v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
- }
- v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in substringData");
+ return v8::Integer::New(privData->nativeObj->getLength());
+}
+v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in substringData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
+ std::string retVal = privData->nativeObj->substringData(localOffset, localCount);
- return v8::String::New(retVal.c_str());
- }
+ return v8::String::New(retVal.c_str());
+}
- v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in appendData");
+v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localArg(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localArg(args[0]);
- privData->nativeObj->appendData(*localArg);
+ privData->nativeObj->appendData(*localArg);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in insertData");
+v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[1]);
- privData->nativeObj->insertData(localOffset, *localArg);
+ privData->nativeObj->insertData(localOffset, *localArg);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in deleteData");
+v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in deleteData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- privData->nativeObj->deleteData(localOffset, localCount);
+ privData->nativeObj->deleteData(localOffset, localCount);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in replaceData");
+v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in replaceData");
- v8::Local<v8::Object> self = args.Holder();
- struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- unsigned long localCount = args[1]->ToNumber()->Uint32Value();
- v8::String::AsciiValue localArg(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[2]);
- privData->nativeObj->replaceData(localOffset, localCount, *localArg);
+ privData->nativeObj->replaceData(localOffset, localCount, *localArg);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
index fe93896..6c51ca7 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
@@ -33,59 +33,59 @@ namespace DOM {
class V8CharacterData {
public:
- struct V8CharacterDataPrivate {
- V8DOM* dom;
- Arabica::DOM::CharacterData<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8CharacterDataPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("CharacterData"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("substringData"),
- v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendData"),
- v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("insertData"),
- v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("deleteData"),
- v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceData"),
- v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8CharacterDataPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CharacterData<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8CharacterDataPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CharacterData"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("substringData"),
+ v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendData"),
+ v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("insertData"),
+ v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("deleteData"),
+ v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceData"),
+ v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
index e470a70..f754ea7 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
- bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
index c659150..074da74 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8Comment {
public:
- struct V8CommentPrivate {
- V8DOM* dom;
- Arabica::DOM::Comment<std::string>* nativeObj;
- };
+ struct V8CommentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Comment<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8CommentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8CommentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Comment"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Comment"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
index 0f81958..f7a7575 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
@@ -5,77 +5,77 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
- v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in hasFeature");
+v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasFeature");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
- bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
+ bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion);
- return v8::Boolean::New(retVal);
- }
+ return v8::Boolean::New(retVal);
+}
- v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in createDocumentType");
+v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocumentType");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localQualifiedName(args[0]);
- v8::String::AsciiValue localPublicId(args[1]);
- v8::String::AsciiValue localSystemId(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localQualifiedName(args[0]);
+ v8::String::AsciiValue localPublicId(args[1]);
+ v8::String::AsciiValue localSystemId(args[2]);
- Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
- v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
+ v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in createDocument");
- if (!(V8DocumentType::hasInstance(args[2])))
- throw V8Exception("Parameter mismatch while calling createDocument");
+v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocument");
+ if (!(V8DocumentType::hasInstance(args[2])))
+ throw V8Exception("Parameter mismatch while calling createDocument");
- v8::Local<v8::Object> self = args.Holder();
- struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
- v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
+ v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Document::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Document::jsDestructor);
+ return retObj;
- }
+}
- bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
index 6fb8c7e..5c58e22 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
@@ -32,45 +32,45 @@ namespace DOM {
class V8DOMImplementation {
public:
- struct V8DOMImplementationPrivate {
- V8DOM* dom;
- Arabica::DOM::DOMImplementation<std::string>* nativeObj;
- };
+ struct V8DOMImplementationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DOMImplementation<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8DOMImplementationPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8DOMImplementationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DOMImplementation"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DOMImplementation"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+ instance->SetInternalFieldCount(1);
- prototype->Set(v8::String::NewSymbol("hasFeature"),
- v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentType"),
- v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocument"),
- v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasFeature"),
+ v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentType"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocument"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
index d9d123a..06191ea 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
@@ -15,397 +15,397 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
- v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getDoctype()) return v8::Undefined();
- Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
+ if (!privData->nativeObj->getDoctype()) return v8::Undefined();
+ Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype());
- v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
- return arbaicaRetObj;
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- }
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+}
- if (!privData->nativeObj->getImplementation()) return v8::Undefined();
- Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
+v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ if (!privData->nativeObj->getImplementation()) return v8::Undefined();
+ Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation());
- struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- }
+ struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
+ return arbaicaRetObj;
- if (!privData->nativeObj->getDocumentElement()) return v8::Undefined();
- Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
+}
- v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
- return arbaicaRetObj;
+ if (!privData->nativeObj->getDocumentElement()) return v8::Undefined();
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement());
- }
- v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createElement");
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTagName(args[0]);
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+}
+v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createElement");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagName(args[0]);
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
- v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
- return retObj;
+ Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment());
+ v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createTextNode");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
+ return retObj;
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData));
- v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createTextNode");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createComment");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
- Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData));
- v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createComment");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
- retObj.MakeWeak(0, V8Comment::jsDestructor);
- return retObj;
+ Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData));
+ v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createCDATASection");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(args[0]);
+ retObj.MakeWeak(0, V8Comment::jsDestructor);
+ return retObj;
- Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
- v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createCDATASection");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
- retObj.MakeWeak(0, V8CDATASection::jsDestructor);
- return retObj;
+ Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
+ v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createProcessingInstruction");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTarget(args[0]);
- v8::String::AsciiValue localData(args[1]);
+ retObj.MakeWeak(0, V8CDATASection::jsDestructor);
+ return retObj;
- Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData));
- v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createProcessingInstruction");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTarget(args[0]);
+ v8::String::AsciiValue localData(args[1]);
- retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
- return retObj;
+ Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData));
+ v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createAttribute");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
+ return retObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createAttribute");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in createEntityReference");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName));
- v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createEntityReference");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- retObj.MakeWeak(0, V8EntityReference::jsDestructor);
- return retObj;
+ Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName));
+ v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementsByTagName");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localTagname(args[0]);
+ retObj.MakeWeak(0, V8EntityReference::jsDestructor);
+ return retObj;
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagname(args[0]);
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in importNode");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling importNode");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- bool localDeep = args[1]->ToBoolean()->BooleanValue();
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in importNode");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling importNode");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ bool localDeep = args[1]->ToBoolean()->BooleanValue();
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createElementNS");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createElementNS");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in createAttributeNS");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createAttributeNS");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementById");
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Local<v8::Object> self = args.Holder();
- struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localElementId(args[0]);
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId));
- v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementById");
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localElementId(args[0]);
- retObj.MakeWeak(0, V8Element::jsDestructor);
- return retObj;
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- }
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
-}
-}
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+
+}
+
+bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
index c12e0dc..2db4b54 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
@@ -33,91 +33,91 @@ namespace DOM {
class V8Document {
public:
- struct V8DocumentPrivate {
- V8DOM* dom;
- Arabica::DOM::Document<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DocumentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Document"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("createElement"),
- v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
- v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createTextNode"),
- v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createComment"),
- v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createCDATASection"),
- v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
- v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttribute"),
- v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEntityReference"),
- v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("importNode"),
- v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createElementNS"),
- v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttributeNS"),
- v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementById"),
- v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("evaluate"),
- v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8DocumentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Document<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8DocumentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Document"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("createElement"),
+ v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
+ v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createTextNode"),
+ v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createComment"),
+ v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createCDATASection"),
+ v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
+ v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttribute"),
+ v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createEntityReference"),
+ v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("importNode"),
+ v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createElementNS"),
+ v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttributeNS"),
+ v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementById"),
+ v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("evaluate"),
+ v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
index e6bec84..1403574 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
- bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
index cf7f6ba..c669b05 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8DocumentFragment {
public:
- struct V8DocumentFragmentPrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentFragment<std::string>* nativeObj;
- };
+ struct V8DocumentFragmentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentFragment<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8DocumentFragmentPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8DocumentFragmentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DocumentFragment"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentFragment"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
index a2098f2..6b9a7b0 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
@@ -5,79 +5,79 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
- v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getName().c_str());
- }
+ return v8::String::New(privData->nativeObj->getName().c_str());
+}
- v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
-
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities());
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- }
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
-
- Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
+}
- v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
- return arbaicaRetObj;
- }
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations());
- v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
- }
+ struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
- }
+}
- v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getInternalSubset().c_str());
- }
- bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+}
-}
-}
+v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+}
+
+v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->nativeObj->getInternalSubset().c_str());
+}
+bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
index 65ce30c..59c2607 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
@@ -33,55 +33,55 @@ namespace DOM {
class V8DocumentType {
public:
- struct V8DocumentTypePrivate {
- V8DOM* dom;
- Arabica::DOM::DocumentType<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8DocumentTypePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("DocumentType"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8DocumentTypePrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentType<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8DocumentTypePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentType"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
index d476daa..680dd5e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
@@ -6,297 +6,297 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
- v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getTagName().c_str());
- }
- v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getAttribute");
+ return v8::String::New(privData->nativeObj->getTagName().c_str());
+}
+v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- std::string retVal = privData->nativeObj->getAttribute(*localName);
+ std::string retVal = privData->nativeObj->getAttribute(*localName);
- return v8::String::New(retVal.c_str());
- }
+ return v8::String::New(retVal.c_str());
+}
- v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in setAttribute");
+v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in setAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
- v8::String::AsciiValue localValue(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+ v8::String::AsciiValue localValue(args[1]);
- privData->nativeObj->setAttribute(*localName, *localValue);
+ privData->nativeObj->setAttribute(*localName, *localValue);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeAttribute");
+v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- privData->nativeObj->removeAttribute(*localName);
+ privData->nativeObj->removeAttribute(*localName);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getAttributeNode");
+v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setAttributeNode");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setAttributeNode");
+v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeAttributeNode");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling removeAttributeNode");
+v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeAttributeNode");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getElementsByTagName");
+v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getAttributeNS");
+v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
+ std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::String::New(retVal.c_str());
- }
+ return v8::String::New(retVal.c_str());
+}
- v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 3)
- throw V8Exception("Wrong number of arguments in setAttributeNS");
+v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in setAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localQualifiedName(args[1]);
- v8::String::AsciiValue localValue(args[2]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ v8::String::AsciiValue localValue(args[2]);
- privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
+ privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in removeAttributeNS");
+v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
+ privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
+v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
- if (!(V8Attr::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
+v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
- v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Attr::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeList::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in hasAttribute");
+v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in hasAttribute");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- bool retVal = privData->nativeObj->hasAttribute(*localName);
+ bool retVal = privData->nativeObj->hasAttribute(*localName);
- return v8::Boolean::New(retVal);
- }
+ return v8::Boolean::New(retVal);
+}
- v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in hasAttributeNS");
+v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasAttributeNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
+ bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName);
- return v8::Boolean::New(retVal);
- }
+ return v8::Boolean::New(retVal);
+}
- bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
index 499ae0e..e5a52bf 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
@@ -33,85 +33,85 @@ namespace DOM {
class V8Element {
public:
- struct V8ElementPrivate {
- V8DOM* dom;
- Arabica::DOM::Element<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8ElementPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Element"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getAttribute"),
- v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttribute"),
- v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttribute"),
- v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNode"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNode"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttribute"),
- v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
- v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8ElementPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Element<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8ElementPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Element"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getAttribute"),
+ v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttribute"),
+ v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttribute"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttribute"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
index 6db7b15..f3ce21d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
@@ -4,32 +4,32 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
- v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
- }
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+}
- v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
- }
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+}
- v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNotationName().c_str());
- }
- bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+ return v8::String::New(privData->nativeObj->getNotationName().c_str());
+}
+bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
index acea6ea..6e85585 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
@@ -33,46 +33,46 @@ namespace DOM {
class V8Entity {
public:
- struct V8EntityPrivate {
- V8DOM* dom;
- Arabica::DOM::Entity<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8EntityPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Entity"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8EntityPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Entity<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8EntityPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Entity"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
index 95ceee8..197fadd 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
@@ -4,11 +4,11 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
- bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
index 9bfb86d..86dd61b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
@@ -33,37 +33,37 @@ namespace DOM {
class V8EntityReference {
public:
- struct V8EntityReferencePrivate {
- V8DOM* dom;
- Arabica::DOM::EntityReference<std::string>* nativeObj;
- };
+ struct V8EntityReferencePrivate {
+ V8DOM* dom;
+ Arabica::DOM::EntityReference<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8EntityReferencePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8EntityReferencePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("EntityReference"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("EntityReference"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+ instance->SetInternalFieldCount(1);
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
index e09bbb8..037d651 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
@@ -4,185 +4,185 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
- v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
- }
- v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in getNamedItem");
+ return v8::Integer::New(privData->nativeObj->getLength());
+}
+v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setNamedItem");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setNamedItem");
+v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItem");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeNamedItem");
+v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeNamedItem");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localName(args[0]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in item");
+v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in getNamedItemNS");
+v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in setNamedItemNS");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling setNamedItemNS");
+v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItemNS");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in removeNamedItemNS");
+v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeNamedItemNS");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNamespaceURI(args[0]);
- v8::String::AsciiValue localLocalName(args[1]);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
index a98c5ee..be89037 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
@@ -32,60 +32,60 @@ namespace DOM {
class V8NamedNodeMap {
public:
- struct V8NamedNodeMapPrivate {
- V8DOM* dom;
- Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NamedNodeMapPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NamedNodeMap"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeNamedItem"),
- v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("item"),
- v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
- v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NamedNodeMapPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NamedNodeMap<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NamedNodeMapPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NamedNodeMap"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
index 31f6457..c5b1b83 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
@@ -5,376 +5,376 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
- v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNodeName().c_str());
- }
+ return v8::String::New(privData->nativeObj->getNodeName().c_str());
+}
- v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getNodeValue().c_str());
- }
+ return v8::String::New(privData->nativeObj->getNodeValue().c_str());
+}
- void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localNodeValue(value);
- privData->nativeObj->setNodeValue(*localNodeValue);
- }
+void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNodeValue(value);
+ privData->nativeObj->setNodeValue(*localNodeValue);
+}
- v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getNodeType());
- }
+ return v8::Integer::New(privData->nativeObj->getNodeType());
+}
- v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getParentNode()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
+ if (!privData->nativeObj->getParentNode()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode());
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- }
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+}
-
- Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
+v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
- return arbaicaRetObj;
+ Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes());
- }
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- if (!privData->nativeObj->getFirstChild()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+}
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- }
+ if (!privData->nativeObj->getFirstChild()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild());
- v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- if (!privData->nativeObj->getLastChild()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
-
- }
-
- v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-
- if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
-
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
-
- }
+}
- v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->getNextSibling()) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
-
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
-
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ if (!privData->nativeObj->getLastChild()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild());
- }
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
- Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+}
- struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
- return arbaicaRetObj;
+v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- }
+ if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling());
- v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- return v8::String::New(privData->nativeObj->getNamespaceURI().c_str());
- }
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- return v8::String::New(privData->nativeObj->getPrefix().c_str());
- }
+}
- void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localPrefix(value);
- privData->nativeObj->setPrefix(*localPrefix);
- }
+v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ if (!privData->nativeObj->getNextSibling()) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling());
- return v8::String::New(privData->nativeObj->getLocalName().c_str());
- }
- v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in insertBefore");
- if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
- throw V8Exception("Parameter mismatch while calling insertBefore");
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+}
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined();
+ Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument());
- }
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in replaceChild");
- if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
- throw V8Exception("Parameter mismatch while calling replaceChild");
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
+ return arbaicaRetObj;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+}
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ return v8::String::New(privData->nativeObj->getNamespaceURI().c_str());
+}
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- }
+ return v8::String::New(privData->nativeObj->getPrefix().c_str());
+}
- v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in removeChild");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling removeChild");
+void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localPrefix(value);
+ privData->nativeObj->setPrefix(*localPrefix);
+}
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ return v8::String::New(privData->nativeObj->getLocalName().c_str());
+}
+v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertBefore");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling insertBefore");
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- }
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in appendChild");
- if (!(V8Node::hasInstance(args[0])))
- throw V8Exception("Parameter mismatch while calling appendChild");
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+}
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in replaceChild");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling replaceChild");
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- }
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+}
- bool retVal = privData->nativeObj->hasChildNodes();
+v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeChild");
- return v8::Boolean::New(retVal);
- }
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in cloneNode");
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- bool localDeep = args[0]->ToBoolean()->BooleanValue();
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+}
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling appendChild");
- }
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj;
- v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- privData->nativeObj->normalize();
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- return v8::Undefined();
- }
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
- if (args.Length() < 2)
- throw V8Exception("Wrong number of arguments in isSupported");
+}
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localFeature(args[0]);
- v8::String::AsciiValue localVersion(args[1]);
+v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
- bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- return v8::Boolean::New(retVal);
- }
+ bool retVal = privData->nativeObj->hasChildNodes();
- v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(retVal);
+}
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in cloneNode");
- bool retVal = privData->nativeObj->hasAttributes();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ bool localDeep = args[0]->ToBoolean()->BooleanValue();
- return v8::Boolean::New(retVal);
- }
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
-}
-}
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+}
+
+v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ privData->nativeObj->normalize();
+
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in isSupported");
+
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
+
+ bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion);
+
+ return v8::Boolean::New(retVal);
+}
+
+v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ bool retVal = privData->nativeObj->hasAttributes();
+
+ return v8::Boolean::New(retVal);
+}
+
+bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
index 6bb90f9..2ea8ddc 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
@@ -32,131 +32,131 @@ namespace DOM {
class V8Node {
public:
- struct V8NodePrivate {
- V8DOM* dom;
- Arabica::DOM::Node<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodePrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> attributesCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Node"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("insertBefore"),
- v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceChild"),
- v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeChild"),
- v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendChild"),
- v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasChildNodes"),
- v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("cloneNode"),
- v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("normalize"),
- v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isSupported"),
- v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributes"),
- v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NodePrivate {
+ V8DOM* dom;
+ Arabica::DOM::Node<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NodePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> attributesCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Node"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("insertBefore"),
+ v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceChild"),
+ v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeChild"),
+ v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendChild"),
+ v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasChildNodes"),
+ v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("cloneNode"),
+ v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("normalize"),
+ v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("isSupported"),
+ v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributes"),
+ v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
index bc2afb5..bee706e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
@@ -4,41 +4,41 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
- v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->getLength());
- }
- v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in item");
+ return v8::Integer::New(privData->nativeObj->getLength());
+}
+v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
- unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
- v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Node::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
- }
+}
- bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
index 8a07998..c454e65 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
@@ -32,44 +32,44 @@ namespace DOM {
class V8NodeList {
public:
- struct V8NodeListPrivate {
- V8DOM* dom;
- Arabica::DOM::NodeList<std::string>* nativeObj;
- };
+ struct V8NodeListPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NodeList<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8NodeListPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8NodeListPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeList"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeList"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetInternalFieldCount(1);
- instance->SetIndexedPropertyHandler(V8NodeList::indexedPropertyCustomGetter, 0);
- prototype->Set(v8::String::NewSymbol("item"),
- v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetIndexedPropertyHandler(V8NodeList::indexedPropertyCustomGetter, 0);
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
index 6f59a90..fade729 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
@@ -3,35 +3,35 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
- v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- return v8::Integer::New(privData->nativeObj->size());
- }
+ return v8::Integer::New(privData->nativeObj->size());
+}
- v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->empty());
- }
- v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(privData->nativeObj->empty());
+}
+v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- privData->nativeObj->to_document_order();
+ privData->nativeObj->to_document_order();
- return v8::Undefined();
- }
+ return v8::Undefined();
+}
- bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
index 78e4410..97b5d4f 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
@@ -32,47 +32,47 @@ namespace DOM {
class V8NodeSet {
public:
- struct V8NodeSetPrivate {
- V8DOM* dom;
- Arabica::XPath::NodeSet<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8NodeSetPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeSet"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
- prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
- v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8NodeSetPrivate {
+ V8DOM* dom;
+ Arabica::XPath::NodeSet<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8NodeSetPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeSet"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
+ prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
+ v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
index 5ecdd10..129563d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
@@ -4,25 +4,25 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
- v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getPublicId().c_str());
- }
+ return v8::String::New(privData->nativeObj->getPublicId().c_str());
+}
- v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getSystemId().c_str());
- }
- bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+ return v8::String::New(privData->nativeObj->getSystemId().c_str());
+}
+bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
index 2102a24..0745728 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
@@ -33,43 +33,43 @@ namespace DOM {
class V8Notation {
public:
- struct V8NotationPrivate {
- V8DOM* dom;
- Arabica::DOM::Notation<std::string>* nativeObj;
- };
+ struct V8NotationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Notation<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8NotationPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8NotationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Notation"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Notation"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
- instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetInternalFieldCount(1);
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
index f28a56d..c6d2b28 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
@@ -4,32 +4,32 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
- v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getTarget().c_str());
- }
+ return v8::String::New(privData->nativeObj->getTarget().c_str());
+}
- v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->getData().c_str());
- }
+ return v8::String::New(privData->nativeObj->getData().c_str());
+}
- void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
- v8::String::AsciiValue localData(value);
- privData->nativeObj->setData(*localData);
- }
- bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->nativeObj->setData(*localData);
+}
+bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
index a588b1f..56b61eb 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
@@ -33,44 +33,44 @@ namespace DOM {
class V8ProcessingInstruction {
public:
- struct V8ProcessingInstructionPrivate {
- V8DOM* dom;
- Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
- };
+ struct V8ProcessingInstructionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::ProcessingInstruction<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
- instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetInternalFieldCount(1);
+ instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
index 54006d5..9679d74 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp
@@ -4,74 +4,74 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl;
- v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->name.c_str());
- }
+ return v8::String::New(privData->nativeObj->name.c_str());
+}
- v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (privData->nativeObj->origin.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->origin.c_str());
- }
+ if (privData->nativeObj->origin.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->origin.c_str());
+}
- v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (privData->nativeObj->origintype.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->origintype.c_str());
- }
+ if (privData->nativeObj->origintype.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->origintype.c_str());
+}
- v8::Handle<v8::Value> V8SCXMLEvent::rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8SCXMLEvent::rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (privData->nativeObj->raw.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->raw.c_str());
- }
+ if (privData->nativeObj->raw.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->raw.c_str());
+}
- v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
- if (!privData->nativeObj->dom) return v8::Undefined();
- Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
+ if (!privData->nativeObj->dom) return v8::Undefined();
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom);
- v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
- struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = arbaicaRet;
-
- arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
- return arbaicaRetObj;
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = arbaicaRet;
- }
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
- v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
+}
- if (privData->nativeObj->invokeid.length() == 0)
- return v8::Undefined();
- return v8::String::New(privData->nativeObj->invokeid.c_str());
- }
- bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0));
-}
-}
+ if (privData->nativeObj->invokeid.length() == 0)
+ return v8::Undefined();
+ return v8::String::New(privData->nativeObj->invokeid.c_str());
+}
+bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
index 992b83e..670d818 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h
@@ -32,66 +32,66 @@ namespace DOM {
class V8SCXMLEvent {
public:
- struct V8SCXMLEventPrivate {
- V8DOM* dom;
- uscxml::Event* nativeObj;
- };
-
- V8_DESTRUCTOR(V8SCXMLEventPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
-
- static v8::Handle<v8::Value> typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> sendidCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("SCXMLEvent"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("raw"), V8SCXMLEvent::rawAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
-
- tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
- prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8SCXMLEventPrivate {
+ V8DOM* dom;
+ uscxml::Event* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8SCXMLEventPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> typeCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> rawAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> sendidCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("SCXMLEvent"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("raw"), V8SCXMLEvent::rawAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+ tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+ prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
index fb027d5..42b298a 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
@@ -4,34 +4,34 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
- v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
- if (args.Length() < 1)
- throw V8Exception("Wrong number of arguments in splitText");
+v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in splitText");
- v8::Local<v8::Object> self = args.Holder();
- struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
- unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
- Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
- v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8Text::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
- }
+}
- bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
index bbf2577..61b92fb 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
@@ -33,40 +33,40 @@ namespace DOM {
class V8Text {
public:
- struct V8TextPrivate {
- V8DOM* dom;
- Arabica::DOM::Text<std::string>* nativeObj;
- };
+ struct V8TextPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Text<std::string>* nativeObj;
+ };
- V8_DESTRUCTOR(V8TextPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
+ V8_DESTRUCTOR(V8TextPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Text"));
- tmpl->ReadOnlyPrototype();
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Text"));
+ tmpl->ReadOnlyPrototype();
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+ instance->SetInternalFieldCount(1);
- prototype->Set(v8::String::NewSymbol("splitText"),
- v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("splitText"),
+ v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- tmpl->Inherit(V8CharacterData::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
index 38f69ae..968e53d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
@@ -4,82 +4,82 @@
namespace Arabica {
namespace DOM {
- v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
+v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
- v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::Number::New(privData->nativeObj->asNumber());
- }
+ return v8::Number::New(privData->nativeObj->asNumber());
+}
- v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::String::New(privData->nativeObj->asString().c_str());
- }
+ return v8::String::New(privData->nativeObj->asString().c_str());
+}
- v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- return v8::Boolean::New(privData->nativeObj->asBool());
- }
- v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
+ return v8::Boolean::New(privData->nativeObj->asBool());
+}
+v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
- v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+ Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet());
+ v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
- struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
+ struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->nativeObj = retVal;
- retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
- retObj.MakeWeak(0, V8NodeSet::jsDestructor);
- return retObj;
+ retObj.MakeWeak(0, V8NodeSet::jsDestructor);
+ return retObj;
- }
+}
- v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
+v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- bool retVal = privData->nativeObj->asBool();
+ bool retVal = privData->nativeObj->asBool();
- return v8::Boolean::New(retVal);
- }
+ return v8::Boolean::New(retVal);
+}
- v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
+v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- std::string retVal = privData->nativeObj->asString();
+ std::string retVal = privData->nativeObj->asString();
- return v8::String::New(retVal.c_str());
- }
+ return v8::String::New(retVal.c_str());
+}
- v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
+v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
- v8::Local<v8::Object> self = args.Holder();
- struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+ v8::Local<v8::Object> self = args.Holder();
+ struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
- double retVal = privData->nativeObj->asNumber();
+ double retVal = privData->nativeObj->asNumber();
- return v8::Number::New(retVal);
- }
+ return v8::Number::New(retVal);
+}
- bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
- return getTmpl()->HasInstance(value);
- }
+bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+}
-}
-}
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
index 1fae618..f6a2d10 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
@@ -32,60 +32,60 @@ namespace DOM {
class V8XPathResult {
public:
- struct V8XPathResultPrivate {
- V8DOM* dom;
- Arabica::XPath::XPathValue<std::string>* nativeObj;
- };
-
- V8_DESTRUCTOR(V8XPathResultPrivate);
- static bool hasInstance(v8::Handle<v8::Value>);
-
- static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
-
- static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
- static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("XPathResult"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- (void)prototype; // surpress unused warnings
-
- instance->SetInternalFieldCount(1);
-
- instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("asNodeSet"),
- v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asBool"),
- v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asString"),
- v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNumber"),
- v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ struct V8XPathResultPrivate {
+ V8DOM* dom;
+ Arabica::XPath::XPathValue<std::string>* nativeObj;
+ };
+
+ V8_DESTRUCTOR(V8XPathResultPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("XPathResult"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ (void)prototype; // surpress unused warnings
+
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("asNodeSet"),
+ v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asBool"),
+ v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asString"),
+ v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asNumber"),
+ v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
};
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
index b031c00..c92274c 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
@@ -23,7 +23,7 @@ SWIDataModel::SWIDataModel() {
// SWI prolog does not support passing user data
static InterpreterImpl* _swiInterpreterPtr;
-
+
boost::shared_ptr<DataModelImpl> SWIDataModel::create(InterpreterImpl* interpreter) {
boost::shared_ptr<SWIDataModel> dm = boost::shared_ptr<SWIDataModel>(new SWIDataModel());
dm->_interpreter = interpreter;
@@ -50,7 +50,7 @@ boost::shared_ptr<DataModelImpl> SWIDataModel::create(InterpreterImpl* interpret
// load SWI XML parser
PlCall("use_module", PlCompound("library", PlTerm("sgml")));
-
+
// load json parser
PlCall("use_module", PlCompound("library", PlTerm("http/json")));
PlCall("use_module", PlCompound("library", PlTerm("http/json_convert")));
@@ -95,7 +95,7 @@ foreign_t SWIDataModel::inPredicate(term_t a0, int arity, void* context) {
}
return FALSE;
}
-
+
void SWIDataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
// std::cout << "SWIDataModel::registerIOProcessor" << std::endl;
}
@@ -129,7 +129,7 @@ void SWIDataModel::setEvent(const Event& event) {
// remove old event
try {
PlCall("retractall(event(_))");
-
+
// simple values
PlCall("assert", PlCompound("event", PlCompound("name", PlTerm(event.name.c_str()))));
PlCall("assert", PlCompound("event", PlCompound("origin", PlString(event.origin.c_str()))));
@@ -140,22 +140,22 @@ void SWIDataModel::setEvent(const Event& event) {
// event.type
std::string type;
switch (event.type) {
- case Event::PLATFORM:
- type = "platform";
- break;
- case Event::INTERNAL:
- type = "internal";
- break;
- case Event::EXTERNAL:
- type = "external";
- break;
+ case Event::PLATFORM:
+ type = "platform";
+ break;
+ case Event::INTERNAL:
+ type = "internal";
+ break;
+ case Event::EXTERNAL:
+ type = "external";
+ break;
}
PlCall("assert", PlCompound("event", PlCompound("type", PlTerm(type.c_str()))));
-
+
// event.sendid
if (!event.hideSendId)
PlCall("assert", PlCompound("event", PlCompound("sendid", PlTerm(event.sendid.c_str()))));
-
+
// event.data
URL domUrl;
if (event.dom) {
@@ -167,8 +167,8 @@ void SWIDataModel::setEvent(const Event& event) {
PlCall(dataInitStr.str().c_str());
} else if (event.content.size() > 0) {
PlCall("assert", PlCompound("event", PlCompound("data", PlString(Interpreter::spaceNormalize(event.content).c_str()))));
- }
-
+ }
+
// event.params
size_t uniqueKeys = 0;
Event::params_t::const_iterator paramIter = event.params.begin();
@@ -195,7 +195,7 @@ void SWIDataModel::setEvent(const Event& event) {
paramExpr << "assert(event(param(" << paramArray.str() << ")))";
//std::cout << paramExpr.str() << std::endl;
PlCall(paramExpr.str().c_str());
-
+
paramIter = lastValueIter;
}
}
@@ -249,7 +249,7 @@ void SWIDataModel::setForeach(const std::string& item,
PlCall("retractall", PlCompound(index.c_str(), 1));
PlCall("retractall", PlCompound(item.c_str(), 1));
PlCall("assert", PlCompound(index.c_str(), PlTerm((long)iteration)));
-
+
std::map<std::string, PlTerm> vars = resolveAtoms(compound, orig);
std::map<std::string, PlTerm>::iterator varIter = vars.begin();
while(varIter != vars.end()) {
@@ -307,28 +307,28 @@ std::string SWIDataModel::evalAsString(const std::string& expr) {
std::map<std::string, PlTerm> SWIDataModel::resolveAtoms(PlTerm& term, PlTerm& orig) {
std::map<std::string, PlTerm> atoms;
switch (orig.type()) {
- case PL_VARIABLE: {
- atoms[(char *)orig] = term;
- break;
+ case PL_VARIABLE: {
+ atoms[(char *)orig] = term;
+ break;
+ }
+ case PL_ATOM:
+ break;
+ case PL_STRING:
+ break;
+ case PL_INTEGER:
+ break;
+ case PL_TERM:
+ for (int i = 1; i <= orig.arity(); i++) {
+ PlTerm newTerm = term[i];
+ PlTerm newOrig = orig[i];
+ std::map<std::string, PlTerm> result = resolveAtoms(newTerm, newOrig);
+ atoms.insert(result.begin(), result.end());
}
- case PL_ATOM:
- break;
- case PL_STRING:
- break;
- case PL_INTEGER:
- break;
- case PL_TERM:
- for (int i = 1; i <= orig.arity(); i++) {
- PlTerm newTerm = term[i];
- PlTerm newOrig = orig[i];
- std::map<std::string, PlTerm> result = resolveAtoms(newTerm, newOrig);
- atoms.insert(result.begin(), result.end());
- }
- break;
+ break;
}
return atoms;
}
-
+
void SWIDataModel::assign(const Arabica::DOM::Element<std::string>& assignElem,
const Arabica::DOM::Document<std::string>& doc,
const std::string& content) {
@@ -353,7 +353,7 @@ void SWIDataModel::assign(const Arabica::DOM::Element<std::string>& assignElem,
callAssert = "asserta";
}
}
-
+
URL domUrl;
Data json;
if (!doc)
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
index e33724f..504dd3a 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h
@@ -62,7 +62,7 @@ public:
static foreign_t inPredicate(term_t a0, int arity, void* context);
protected:
std::map<std::string, PlTerm> resolveAtoms(PlTerm& term, PlTerm& orig);
-
+
Event _event;
PlEngine* _plEngine;
diff --git a/src/uscxml/plugins/element/mmi/MMIEvents.cpp b/src/uscxml/plugins/element/mmi/MMIEvents.cpp
index 5d688ff..f1110b7 100644
--- a/src/uscxml/plugins/element/mmi/MMIEvents.cpp
+++ b/src/uscxml/plugins/element/mmi/MMIEvents.cpp
@@ -1,42 +1,42 @@
#include "MMIEvents.h"
namespace uscxml {
-
- void PrepareRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void StartRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void PauseRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void ResumeRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void CancelRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void ClearContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void StatusRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void NewContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void PrepareResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void StartResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void PauseResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void ResumeResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void CancelResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void ClearContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void StatusResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void DoneNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void NewContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
- void ExtensionNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
- }
+
+void PrepareRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void StartRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void PauseRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void ResumeRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void CancelRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void ClearContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void StatusRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void NewContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void PrepareResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void StartResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void PauseResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void ResumeResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void CancelResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void ClearContextResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void StatusResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void DoneNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void NewContextRequestElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
+void ExtensionNotificationElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
+}
} \ No newline at end of file
diff --git a/src/uscxml/plugins/element/mmi/MMIEvents.h b/src/uscxml/plugins/element/mmi/MMIEvents.h
index 3a31f2a..5df48ec 100644
--- a/src/uscxml/plugins/element/mmi/MMIEvents.h
+++ b/src/uscxml/plugins/element/mmi/MMIEvents.h
@@ -47,7 +47,7 @@ ELEMENT_MMI_CLASS(StatusResponse);
ELEMENT_MMI_CLASS(DoneNotification);
ELEMENT_MMI_CLASS(NewContextRequest);
ELEMENT_MMI_CLASS(ExtensionNotification);
-
+
#ifdef BUILD_AS_PLUGINS
PLUMA_INHERIT_PROVIDER(FetchElement, ExecutableContentImpl);
#endif
diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt
index 3f43acb..4e74a8c 100644
--- a/src/uscxml/plugins/invoker/CMakeLists.txt
+++ b/src/uscxml/plugins/invoker/CMakeLists.txt
@@ -32,6 +32,23 @@ else()
list (APPEND USCXML_FILES ${DIRMON_INVOKER})
endif()
+# System invoker to open a native command
+
+file(GLOB_RECURSE XHTML_INVOKER
+ xhtml/*.cpp
+ xhtml/*.h
+)
+source_group("Invoker\\xhtml" FILES ${XHTML_INVOKER})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ invoker_xhtml SHARED
+ ${XHTML_INVOKER})
+ target_link_libraries(invoker_xhtml uscxml)
+ set_target_properties(invoker_xhtml PROPERTIES FOLDER "Plugin Invoker")
+else()
+ list (APPEND USCXML_FILES ${XHTML_INVOKER})
+endif()
+
# System invoker to open a native command
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
index 771b159..2c395a8 100644
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp
@@ -95,7 +95,7 @@ void HTTPServletInvoker::invoke(const InvokeRequest& req) {
/**
* Receive a request and deliver it to the interpreter
*/
-void HTTPServletInvoker::httpRecvRequest(const HTTPServer::Request& req) {
+bool HTTPServletInvoker::httpRecvRequest(const HTTPServer::Request& req) {
tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
// evhttp_request_own(req.curlReq);
@@ -108,7 +108,7 @@ void HTTPServletInvoker::httpRecvRequest(const HTTPServer::Request& req) {
event.data.compound["reqId"] = Data(toStr((uintptr_t)req.curlReq), Data::VERBATIM);
returnEvent(event);
-
+ return true;
}
std::string HTTPServletInvoker::getPath() {
diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
index de9c300..e2d3b2b 100644
--- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
+++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h
@@ -29,7 +29,7 @@ public:
virtual void invoke(const InvokeRequest& req);
// HTTPServlet
- virtual void httpRecvRequest(const HTTPServer::Request& req);
+ virtual bool httpRecvRequest(const HTTPServer::Request& req);
virtual std::string getPath();
virtual void setURL(const std::string& url) {
_url = url;
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
index 6e0b2af..a71d21a 100644
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
@@ -29,7 +29,7 @@ boost::shared_ptr<InvokerImpl> VoiceXMLInvoker::create(InterpreterImpl* interpre
invoker->_pub.registerType("LifeCycleEvent", new ::LifeCycleEvent());
-
+
invoker->_node.addPublisher(invoker->_pub);
invoker->_node.addSubscriber(invoker->_sub);
@@ -50,7 +50,7 @@ void VoiceXMLInvoker::send(const SendRequest& req) {
std::stringstream domSS;
domSS << req.getFirstDOMElement();
start.content = domSS.str();
-
+
start.contentURL.href = "http://localhost/~sradomski/hello.vxml";
start.requestId = "asdf";
start.source = "asdf";
@@ -61,7 +61,7 @@ void VoiceXMLInvoker::send(const SendRequest& req) {
void VoiceXMLInvoker::invoke(const InvokeRequest& req) {
_pub.waitForSubscribers(1);
-
+
}
} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
index ca5f557..d89382e 100644
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
+++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h
@@ -34,7 +34,7 @@ public:
virtual void send(const SendRequest& req);
virtual void invoke(const InvokeRequest& req);
-
+
protected:
umundo::Node _node;
umundo::TypedPublisher _pub;
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
new file mode 100644
index 0000000..0c7ef08
--- /dev/null
+++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
@@ -0,0 +1,195 @@
+#include <uscxml/config.h>
+#include "XHTMLInvoker.h"
+#include <glog/logging.h>
+#include <uscxml/plugins/ioprocessor/comet/CometIOProcessor.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+#if defined(__APPLE__) and defined(TARGET_OS_MAC)
+#include <CoreFoundation/CFBundle.h>
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool connect(pluma::Host& host) {
+ host.add( new XHTMLInvokerProvider() );
+ return true;
+}
+#endif
+
+XHTMLInvoker::XHTMLInvoker() {
+}
+
+XHTMLInvoker::~XHTMLInvoker() {
+};
+
+boost::shared_ptr<InvokerImpl> XHTMLInvoker::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<XHTMLInvoker> invoker = boost::shared_ptr<XHTMLInvoker>(new XHTMLInvoker());
+ invoker->_interpreter = interpreter;
+// _ioProc = interpreter->getFactory()->createIOProcessor("comet", interpreter);
+ return invoker;
+}
+
+bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ // these are the XHR requests
+ if (boost::iequals(req.data["header"]["X-Requested-With"].atom, "XMLHttpRequest")) {
+ if (boost::iequals(req.data["type"].atom, "get")) {
+ if (_longPoll) {
+ evhttp_send_error(_longPoll.curlReq, 204, NULL);
+ _longPoll.curlReq = NULL;
+ }
+ _longPoll = req;
+ if (!_outQueue.empty()) {
+ send(_outQueue.front());
+ _outQueue.pop_front();
+ }
+ return true;
+ } else {
+ Event ev(req);
+ if (ev.data["header"]["X-SCXML-Name"]) {
+ ev.name = ev.data["header"]["X-SCXML-Name"].atom;
+ }
+ ev.origin = _invokeId;
+ ev.initContent(req.data["content"].atom);
+ ev.data.compound["Connection"] = req.data;
+ // content is already on ev.raw
+ ev.data.compound["Connection"].compound.erase("content");
+
+ returnEvent(ev);
+ return true;
+ }
+ }
+
+ // initial request for a document
+ if (!req.data["query"] && // no query parameters
+ boost::iequals(req.data["type"].atom, "get") && // request type is GET
+ (boost::icontains(req.data["header"]["Accept"].atom, "text/html") || // accepts html or
+ boost::contains(req.data["header"]["User-Agent"].atom, "MSIE")) && // is the internet explorer
+ req.content.length() == 0) { // no content
+
+ HTTPServer::Reply reply(req);
+ URL templateURL("templates/xhtml-invoker.html");
+ templateURL.toAbsolute(_interpreter->getBaseURI());
+ templateURL.download(true);
+ std::string templateContent = templateURL.getInContent();
+ boost::replace_all(templateContent, "${scxml.server}", _url);
+ boost::replace_all(templateContent, "${scxml.invokeId}", _invokeId);
+
+ std::string content;
+ std::stringstream ss;
+ if (_invokeReq.dom) {
+ ss << _invokeReq.getFirstDOMElement();
+ content = ss.str();
+ } else if(_invokeReq.data) {
+ ss << _invokeReq.data;
+ content = ss.str();
+ } else {
+ content = _invokeReq.content;
+ }
+ boost::replace_all(templateContent, "${scxml.content}", content);
+ reply.content = templateContent;
+ reply.headers["Content-Type"] = "text/html";
+
+ // aggressive caching in IE will return all XHR get requests instantenously with the template otherwise
+ reply.headers["Cache-Control"] = "no-cache";
+
+ HTTPServer::reply(reply);
+
+ // queue invoke request for initial html
+ _longPoll.curlReq = NULL;
+ _outQueue = std::deque<SendRequest>();
+ SendRequest sendReq(_invokeReq);
+ send(sendReq);
+
+ return true;
+ }
+
+ // don't know what to do with other requests
+ return false;
+}
+
+Data XHTMLInvoker::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void XHTMLInvoker::send(const SendRequest& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (!_longPoll) {
+ _outQueue.push_back(req);
+ return;
+ }
+ reply(req, _longPoll);
+ _longPoll.curlReq = NULL;
+}
+
+void XHTMLInvoker::reply(const SendRequest& req, const HTTPServer::Request& longPoll) {
+ HTTPServer::Reply reply(longPoll);
+
+ if (req.dom) {
+ std::stringstream ss;
+ Arabica::DOM::Node<std::string> content = req.dom.getDocumentElement();
+ if (content && boost::iequals(content.getLocalName(), "content")) {
+ reply.headers["X-SCXML-Type"] = (HAS_ATTR(content, "type") ? ATTR(content, "type") : "replacechildren");
+ reply.headers["X-SCXML-XPath"] = (HAS_ATTR(content, "xpath") ? ATTR(content, "xpath") : "/html/body");
+ if (HAS_ATTR(content, "attr"))
+ reply.headers["X-SCXML-Attr"] = ATTR(content, "attr");
+ }
+ ss << req.getFirstDOMElement();
+ reply.content = ss.str();
+ reply.headers["Content-Type"] = "application/xml";
+ } else if (req.data) {
+ reply.content = Data::toJSON(req.data);
+ reply.headers["Content-Type"] = "application/json";
+ } else if (req.content.length() > 0) {
+ reply.content = req.content;
+ reply.headers["Content-Type"] = "application/text";
+ }
+
+ if (req.params.find("Content-Type") != req.params.end())
+ reply.headers["Content-Type"] = req.params.find("Content-Type")->first;
+
+ HTTPServer::reply(reply);
+}
+
+void XHTMLInvoker::cancel(const std::string sendId) {
+}
+
+void XHTMLInvoker::invoke(const InvokeRequest& req) {
+ _invokeReq = req;
+ HTTPServer::registerServlet(_interpreter->getName() + "/xhtml/" + req.invokeid, this);
+#if defined(__APPLE__) and defined(TARGET_OS_MAC)
+ // see http://stackoverflow.com/questions/4177744/c-osx-open-default-browser
+ CFURLRef url = CFURLCreateWithBytes (
+ NULL, // allocator
+ (UInt8*)_url.c_str(), // URLBytes
+ _url.length(), // length
+ kCFStringEncodingASCII, // encoding
+ NULL // baseURL
+ );
+ LSOpenCFURLRef(url,0);
+ CFRelease(url);
+ return;
+#endif
+#ifdef _WIN32
+// see http://support.microsoft.com/kb/224816
+ ShellExecute(NULL, "open", _url.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ return;
+#endif
+#ifdef HAS_XDG_OPEN
+ std::string systemCmd;
+ systemCmd = "xdg-open ";
+ systemCmd += _url;
+ system(systemCmd.c_str());
+ return;
+#endif
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
new file mode 100644
index 0000000..e94c4fd
--- /dev/null
+++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h
@@ -0,0 +1,55 @@
+#ifndef XHTMLINVOKER_H_W09J90F0
+#define XHTMLINVOKER_H_W09J90F0
+
+#include <uscxml/Interpreter.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class XHTMLInvoker : public InvokerImpl, public HTTPServlet {
+public:
+ XHTMLInvoker();
+ virtual ~XHTMLInvoker();
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("xhtml");
+ names.insert("http://www.w3.org/1999/xhtml");
+ return names;
+ }
+
+ virtual Data getDataModelVariables();
+ virtual void send(const SendRequest& req);
+ virtual void cancel(const std::string sendId);
+ virtual void invoke(const InvokeRequest& req);
+
+ // HTTPServlet
+ virtual bool httpRecvRequest(const HTTPServer::Request& request);
+ virtual void setURL(const std::string& url) {
+ _url = url;
+ }
+
+ void reply(const SendRequest& req, const HTTPServer::Request& longPoll);
+
+protected:
+ HTTPServer::Request _longPoll;
+ std::deque<SendRequest> _outQueue;
+
+ tthread::recursive_mutex _mutex;
+ InvokeRequest _invokeReq;
+ IOProcessor _ioProc;
+ std::string _url;
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(XHTMLInvoker, InvokerImpl);
+#endif
+
+}
+
+
+#endif /* end of include guard: XHTMLINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
index 0fab6a4..9fda5f8 100644
--- a/src/uscxml/plugins/ioprocessor/CMakeLists.txt
+++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
@@ -1,3 +1,34 @@
+file(GLOB_RECURSE SAMPLE_IOPROCESSOR
+ sample/*.cpp
+ sample/*.h
+)
+source_group("IOProcessor\\sample" FILES ${SAMPLE_IOPROCESSOR})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ ioprocessor_sample SHARED
+ ${SAMPLE_IOPROCESSOR})
+ target_link_libraries(ioprocessor_sample uscxml)
+ set_target_properties(ioprocessor_sample PROPERTIES FOLDER "Plugin IOProcessor")
+else()
+ list (APPEND USCXML_FILES ${SAMPLE_IOPROCESSOR})
+endif()
+
+file(GLOB_RECURSE COMET_IOPROCESSOR
+ comet/*.cpp
+ comet/*.h
+)
+source_group("IOProcessor\\comet" FILES ${COMET_IOPROCESSOR})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ ioprocessor_comet SHARED
+ ${COMET_IOPROCESSOR})
+ target_link_libraries(ioprocessor_comet uscxml)
+ set_target_properties(ioprocessor_comet PROPERTIES FOLDER "Plugin IOProcessor")
+else()
+ list (APPEND USCXML_FILES ${COMET_IOPROCESSOR})
+endif()
+
+
# LIBEVENT basichttp ioprocessor - this one is already required above
file(GLOB_RECURSE BASICHTTP_IOPROCESSOR
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 6ddb83c..b2a6824 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -68,7 +68,7 @@ Data BasicHTTPIOProcessor::getDataModelVariables() {
return data;
}
-void BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
Event reqEvent = req;
reqEvent.type = Event::EXTERNAL;
bool scxmlStructFound = false;
@@ -138,6 +138,7 @@ void BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
returnEvent(reqEvent);
evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+ return true;
}
void BasicHTTPIOProcessor::send(const SendRequest& req) {
@@ -189,7 +190,7 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) {
}
// content
-
+
if (req.content.size() > 0) {
kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
kvpSeperator = "&";
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
index 1848e5e..c0fddc1 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
@@ -36,7 +36,7 @@ public:
Data getDataModelVariables();
/// HTTPServlet
- void httpRecvRequest(const HTTPServer::Request& req);
+ bool httpRecvRequest(const HTTPServer::Request& req);
void setURL(const std::string& url) {
_url = url;
}
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp
new file mode 100644
index 0000000..8fd1172
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp
@@ -0,0 +1,94 @@
+#include <uscxml/Common.h>
+#include "uscxml/plugins/ioprocessor/comet/CometIOProcessor.h"
+#include "uscxml/Message.h"
+#include <iostream>
+
+#include <string.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool connect(pluma::Host& host) {
+ host.add( new CometIOProcessorProvider() );
+ return true;
+}
+#endif
+
+CometIOProcessor::CometIOProcessor() {
+}
+
+CometIOProcessor::~CometIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> CometIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<CometIOProcessor> io = boost::shared_ptr<CometIOProcessor>(new CometIOProcessor());
+ io->_interpreter = interpreter;
+
+ // register at http server
+ std::string path = interpreter->getName();
+ int i = 2;
+ while (!HTTPServer::registerServlet(path + "/comet", io.get())) {
+ std::stringstream ss;
+ ss << interpreter->getName() << i++;
+ path = ss.str();
+ }
+
+ return io;
+}
+
+Data CometIOProcessor::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void CometIOProcessor::send(const SendRequest& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (!_longPollingReq) {
+ _outQueue.push_back(req);
+ return;
+ }
+ reply(req, _longPollingReq);
+}
+
+void CometIOProcessor::reply(const SendRequest& req, const HTTPServer::Request& longPoll) {
+ HTTPServer::Reply reply(longPoll);
+
+ if (req.dom) {
+ std::stringstream ss;
+ ss << req.dom;
+ reply.content = ss.str();
+ reply.headers["Content-Type"] = "application/xml";
+ } else if (req.data) {
+ reply.content = Data::toJSON(req.data);
+ reply.headers["Content-Type"] = "application/json";
+ } else if (req.content.length() > 0) {
+ reply.content = req.content;
+ reply.headers["Content-Type"] = "text/plain";
+ }
+
+ if (req.params.find("Content-Type") != req.params.end())
+ reply.headers["Content-Type"] = req.params.find("Content-Type")->first;
+
+ HTTPServer::reply(reply);
+}
+
+bool CometIOProcessor::httpRecvRequest(const HTTPServer::Request& request) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ if (_longPollingReq)
+ // send 204 to last request and remember new one
+ evhttp_send_error(_longPollingReq.curlReq, 204, NULL);
+ _longPollingReq = request;
+ if (!_outQueue.empty()) {
+ send(_outQueue.front());
+ _outQueue.pop_front();
+ }
+ return true;
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
new file mode 100644
index 0000000..05a3798
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
@@ -0,0 +1,53 @@
+#ifndef COMETIOPROCESSOR_H_2CUY93KU
+#define COMETIOPROCESSOR_H_2CUY93KU
+
+#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h"
+#include "uscxml/server/HTTPServer.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class CometIOProcessor : public IOProcessorImpl, public HTTPServlet {
+public:
+ CometIOProcessor();
+ virtual ~CometIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("comet");
+ names.insert("http://www.w3.org/TR/scxml/#CometEventProcessor");
+ return names;
+ }
+
+ /// This method can be overridden for specific replies
+ virtual void reply(const SendRequest& req, const HTTPServer::Request& longPoll);
+
+ virtual void send(const SendRequest& req);
+ Data getDataModelVariables();
+
+ virtual bool httpRecvRequest(const HTTPServer::Request& request);
+ virtual void setURL(const std::string& url) {
+ _url = url;
+ }
+
+protected:
+ tthread::recursive_mutex _mutex;
+ std::string _url;
+ std::deque<SendRequest> _outQueue;
+ HTTPServer::Request _longPollingReq;
+
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(CometIOProcessor, IOProcessorImpl);
+#endif
+
+}
+
+#endif /* end of include guard: COMETIOPROCESSOR_H_2CUY93KU */ \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
index 4734ff5..25e0f8c 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
@@ -37,7 +37,7 @@ boost::shared_ptr<IOProcessorImpl> MMIHTTPIOProcessor::create(InterpreterImpl* i
return io;
}
-void MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+bool MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
Event reqEvent = req;
reqEvent.type = Event::EXTERNAL;
bool scxmlStructFound = false;
@@ -107,6 +107,7 @@ void MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
returnEvent(reqEvent);
evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+ return true;
}
void MMIHTTPIOProcessor::send(const SendRequest& req) {
@@ -158,7 +159,7 @@ void MMIHTTPIOProcessor::send(const SendRequest& req) {
}
// content
-
+
if (req.content.size() > 0) {
kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
kvpSeperator = "&";
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
index 2dbd595..3c0a9a9 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
@@ -16,37 +16,37 @@
#endif
namespace uscxml {
-
- class MMIHTTPIOProcessor : public BasicHTTPIOProcessor {
- public:
- MMIHTTPIOProcessor();
- virtual ~MMIHTTPIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
-
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("mmihttp");
- names.insert("http://www.w3.org/TR/mmi-arch/#HTTPTransport");
- return names;
- }
-
- virtual void send(const SendRequest& req);
-
- /// HTTPServlet
- void httpRecvRequest(const HTTPServer::Request& req);
-
- bool canAdaptPath() {
- return false;
- }
-
- protected:
- std::string _url;
- std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
- };
-
- #ifdef BUILD_AS_PLUGINS
- PLUMA_INHERIT_PROVIDER(MMIHTTPIOProcessor, IOProcessorImpl);
- #endif
+
+class MMIHTTPIOProcessor : public BasicHTTPIOProcessor {
+public:
+ MMIHTTPIOProcessor();
+ virtual ~MMIHTTPIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("mmihttp");
+ names.insert("http://www.w3.org/TR/mmi-arch/#HTTPTransport");
+ return names;
+ }
+
+ virtual void send(const SendRequest& req);
+
+ /// HTTPServlet
+ bool httpRecvRequest(const HTTPServer::Request& req);
+
+ bool canAdaptPath() {
+ return false;
+ }
+
+protected:
+ std::string _url;
+ std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(MMIHTTPIOProcessor, IOProcessorImpl);
+#endif
}
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
index bf32b9d..006b9e0 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
@@ -22,68 +22,71 @@ using namespace Arabica::DOM;
std::string MMIEvent::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
- MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) {
- if (!node)
- return INVALID;
-
- if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST"))
- return NEWCONTEXTREQUEST;
- if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE"))
- return NEWCONTEXTRESPONSE;
- if (boost::iequals(node.getLocalName(), "PREPAREREQUEST"))
- return PREPAREREQUEST;
- if (boost::iequals(node.getLocalName(), "PREPARERESPONSE"))
- return PREPARERESPONSE;
- if (boost::iequals(node.getLocalName(), "STARTREQUEST"))
- return STARTREQUEST;
- if (boost::iequals(node.getLocalName(), "STARTRESPONSE"))
- return STARTRESPONSE;
- if (boost::iequals(node.getLocalName(), "DONENOTIFICATION"))
- return DONENOTIFICATION;
- if (boost::iequals(node.getLocalName(), "CANCELREQUEST"))
- return CANCELREQUEST;
- if (boost::iequals(node.getLocalName(), "CANCELRESPONSE"))
- return CANCELRESPONSE;
- if (boost::iequals(node.getLocalName(), "PAUSEREQUEST"))
- return PAUSEREQUEST;
- if (boost::iequals(node.getLocalName(), "PAUSERESPONSE"))
- return PAUSERESPONSE;
- if (boost::iequals(node.getLocalName(), "RESUMEREQUEST"))
- return RESUMEREQUEST;
- if (boost::iequals(node.getLocalName(), "RESUMERESPONSE"))
- return RESUMERESPONSE;
- if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION"))
- return EXTENSIONNOTIFICATION;
- if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST"))
- return CLEARCONTEXTREQUEST;
- if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE"))
- return CLEARCONTEXTRESPONSE;
- if (boost::iequals(node.getLocalName(), "STATUSREQUEST"))
- return STATUSREQUEST;
- if (boost::iequals(node.getLocalName(), "STATUSRESPONSE"))
- return STATUSRESPONSE;
+MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) {
+ if (!node)
return INVALID;
+
+ if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST"))
+ return NEWCONTEXTREQUEST;
+ if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE"))
+ return NEWCONTEXTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "PREPAREREQUEST"))
+ return PREPAREREQUEST;
+ if (boost::iequals(node.getLocalName(), "PREPARERESPONSE"))
+ return PREPARERESPONSE;
+ if (boost::iequals(node.getLocalName(), "STARTREQUEST"))
+ return STARTREQUEST;
+ if (boost::iequals(node.getLocalName(), "STARTRESPONSE"))
+ return STARTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "DONENOTIFICATION"))
+ return DONENOTIFICATION;
+ if (boost::iequals(node.getLocalName(), "CANCELREQUEST"))
+ return CANCELREQUEST;
+ if (boost::iequals(node.getLocalName(), "CANCELRESPONSE"))
+ return CANCELRESPONSE;
+ if (boost::iequals(node.getLocalName(), "PAUSEREQUEST"))
+ return PAUSEREQUEST;
+ if (boost::iequals(node.getLocalName(), "PAUSERESPONSE"))
+ return PAUSERESPONSE;
+ if (boost::iequals(node.getLocalName(), "RESUMEREQUEST"))
+ return RESUMEREQUEST;
+ if (boost::iequals(node.getLocalName(), "RESUMERESPONSE"))
+ return RESUMERESPONSE;
+ if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION"))
+ return EXTENSIONNOTIFICATION;
+ if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST"))
+ return CLEARCONTEXTREQUEST;
+ if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE"))
+ return CLEARCONTEXTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "STATUSREQUEST"))
+ return STATUSREQUEST;
+ if (boost::iequals(node.getLocalName(), "STATUSRESPONSE"))
+ return STATUSRESPONSE;
+ return INVALID;
+}
+
+Arabica::DOM::Node<std::string> MMIEvent::getEventNode(Arabica::DOM::Node<std::string> node) {
+ if (!node)
+ return node;
+
+ if (node.getNodeType() == Node_base::DOCUMENT_NODE)
+ node = Arabica::DOM::Document<std::string>(node).getDocumentElement();
+
+ // get the first element
+ while (node && node.getNodeType() != Node_base::ELEMENT_NODE) {
+ node = node.getNextSibling();
}
-
- Arabica::DOM::Node<std::string> MMIEvent::getEventNode(Arabica::DOM::Node<std::string> node) {
- if (node.getNodeType() == Node_base::DOCUMENT_NODE)
- node = Arabica::DOM::Document<std::string>(node).getDocumentElement();
-
- // get the first element
- while (node && node.getNodeType() != Node_base::ELEMENT_NODE) {
+ // get the contained message
+ if (node && getType(node) == INVALID) {
+ node = node.getFirstChild();
+ while (node && node.getNodeType() != Node_base::ELEMENT_NODE && getType(node) == INVALID) {
node = node.getNextSibling();
}
- // get the contained message
- if (node && getType(node) == INVALID) {
- node = node.getFirstChild();
- while (node && node.getNodeType() != Node_base::ELEMENT_NODE && getType(node) == INVALID) {
- node = node.getNextSibling();
- }
- }
- return node;
}
+ return node;
+}
+
-
Arabica::DOM::Document<std::string> MMIEvent::toXML() const {
Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
Document<std::string> doc = domFactory.createDocument(nameSpace, "", 0);
@@ -255,7 +258,7 @@ MMIEvent::operator Event() const {
}
return ev;
}
-
+
ContextualizedRequest ContextualizedRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
ContextualizedRequest msg(MMIEvent::fromXML(node, interpreter));
while (node) {
@@ -273,8 +276,8 @@ ContextualizedRequest::operator Event() const {
// do we want to represent the context? It's the interpreters name already
return ev;
}
-
-
+
+
ContentRequest ContentRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
ContentRequest msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
@@ -424,5 +427,5 @@ StatusRequest StatusRequest::fromXML(Arabica::DOM::Node<std::string> node, Inter
return msg;
}
-
+
} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
index b7d017f..aedd88c 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
@@ -10,44 +10,44 @@ namespace uscxml {
class MMIEvent {
public:
enum Type {
- NEWCONTEXTREQUEST,
- NEWCONTEXTRESPONSE,
- PREPAREREQUEST,
- PREPARERESPONSE,
- STARTREQUEST,
- STARTRESPONSE,
- DONENOTIFICATION,
- CANCELREQUEST,
- CANCELRESPONSE,
- PAUSEREQUEST,
- PAUSERESPONSE,
- RESUMEREQUEST,
- RESUMERESPONSE,
- EXTENSIONNOTIFICATION,
- CLEARCONTEXTREQUEST,
- CLEARCONTEXTRESPONSE,
- STATUSREQUEST,
- STATUSRESPONSE,
- INVALID
+ NEWCONTEXTREQUEST,
+ NEWCONTEXTRESPONSE,
+ PREPAREREQUEST,
+ PREPARERESPONSE,
+ STARTREQUEST,
+ STARTRESPONSE,
+ DONENOTIFICATION,
+ CANCELREQUEST,
+ CANCELRESPONSE,
+ PAUSEREQUEST,
+ PAUSERESPONSE,
+ RESUMEREQUEST,
+ RESUMERESPONSE,
+ EXTENSIONNOTIFICATION,
+ CLEARCONTEXTREQUEST,
+ CLEARCONTEXTRESPONSE,
+ STATUSREQUEST,
+ STATUSRESPONSE,
+ INVALID
};
-
+
static Type getType(Arabica::DOM::Node<std::string> node);
static Arabica::DOM::Node<std::string> getEventNode(Arabica::DOM::Node<std::string> node);
-
+
virtual Arabica::DOM::Document<std::string> toXML() const;
static MMIEvent fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
// conversion operator
operator Event() const;
-
+
std::string source;
std::string target;
std::string data;
std::string requestId;
std::string tagName;
Type type;
-
+
static std::string nameSpace;
protected:
@@ -72,7 +72,7 @@ public:
}
NewContextRequest(const MMIEvent& father) : MMIEvent(father) {}
static NewContextRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
MMIEvent event = MMIEvent::fromXML(node, interpreter);
event.type = NEWCONTEXTREQUEST;
return event;
@@ -90,7 +90,7 @@ class ContextualizedRequest : public MMIEvent {
public:
virtual Arabica::DOM::Document<std::string> toXML() const;
static ContextualizedRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
std::string context;
protected:
@@ -106,7 +106,7 @@ public:
}
PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static PauseRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PauseRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = PAUSEREQUEST;
return event;
@@ -127,7 +127,7 @@ public:
}
ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static ResumeRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ResumeRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = RESUMEREQUEST;
return event;
@@ -148,7 +148,7 @@ public:
}
CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static CancelRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
CancelRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = CANCELREQUEST;
return event;
@@ -169,7 +169,7 @@ public:
}
ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static ClearContextRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ClearContextRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = CLEARCONTEXTREQUEST;
return event;
@@ -190,7 +190,7 @@ public:
}
virtual Arabica::DOM::Document<std::string> toXML() const;
static StatusRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
bool automaticUpdate;
protected:
@@ -207,7 +207,7 @@ public:
virtual Arabica::DOM::Document<std::string> toXML() const;
static ContentRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
std::string content;
ContentURL contentURL;
@@ -224,7 +224,7 @@ public:
}
PrepareRequest(const ContentRequest& father) : ContentRequest(father) {}
static PrepareRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PrepareRequest event = ContentRequest::fromXML(node, interpreter);
event.type = PREPAREREQUEST;
return event;
@@ -245,7 +245,7 @@ public:
}
StartRequest(const ContentRequest& father) : ContentRequest(father) {}
static StartRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
StartRequest event = ContentRequest::fromXML(node, interpreter);
event.type = STARTREQUEST;
return event;
@@ -267,7 +267,7 @@ public:
}
virtual Arabica::DOM::Document<std::string> toXML() const;
static ExtensionNotification fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
std::string name;
protected:
@@ -290,7 +290,7 @@ public:
}
virtual Arabica::DOM::Document<std::string> toXML() const;
static StatusResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
Status status;
protected:
StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
@@ -301,7 +301,7 @@ public:
virtual Arabica::DOM::Document<std::string> toXML() const;
StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
static StatusInfoResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
std::string statusInfo;
protected:
StatusInfoResponse() {}
@@ -315,7 +315,7 @@ public:
}
PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static PrepareResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PrepareResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = PREPARERESPONSE;
return event;
@@ -336,7 +336,7 @@ public:
}
StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static StartResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
StartResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = STARTRESPONSE;
return event;
@@ -357,7 +357,7 @@ public:
}
CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static CancelResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
CancelResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = CANCELRESPONSE;
return event;
@@ -378,7 +378,7 @@ public:
}
PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static PauseResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PauseResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = PAUSERESPONSE;
return event;
@@ -399,7 +399,7 @@ public:
}
ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static ResumeResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ResumeResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = RESUMERESPONSE;
return event;
@@ -420,7 +420,7 @@ public:
}
ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static ClearContextResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ClearContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = CLEARCONTEXTRESPONSE;
return event;
@@ -441,7 +441,7 @@ public:
}
NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static NewContextResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
NewContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = NEWCONTEXTRESPONSE;
return event;
@@ -463,7 +463,7 @@ public:
}
DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static DoneNotification fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
DoneNotification event = StatusInfoResponse::fromXML(node, interpreter);
event.type = DONENOTIFICATION;
return event;
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
index 55ee9fe..9e8b5c2 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
@@ -11,7 +11,7 @@ namespace uscxml {
::LifeCycleEvent MMIProtoBridge::toProto(const NewContextRequest& mmiEvent) {
INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_NEW_CONTEXT_REQUEST);
- return lifeCycleEvent;
+ return lifeCycleEvent;
}
::LifeCycleEvent MMIProtoBridge::toProto(const NewContextResponse& mmiEvent) {
@@ -32,13 +32,13 @@ namespace uscxml {
::LifeCycleEvent MMIProtoBridge::toProto(const StartRequest& mmiEvent) {
INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_START_REQUEST);
- ::LifeCycleRequest* lifeCycleRequest = lifeCycleEvent.MutableExtension(::LifeCycleRequest::Request);
+ ::LifeCycleRequest* lifeCycleRequest = lifeCycleEvent.MutableExtension(::LifeCycleRequest::Request);
lifeCycleRequest->set_context(mmiEvent.context);
-
+
::StartRequest* startRequest = lifeCycleRequest->MutableExtension(::StartRequest::Request);
startRequest->set_content(mmiEvent.content);
startRequest->set_contenturl(mmiEvent.contentURL.href);
-
+
::StartRequestData* startRequestData = startRequest->MutableExtension(::StartRequestData::Request);
startRequestData->set_data(mmiEvent.data);
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
index 32a69f6..af6c720 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
@@ -6,7 +6,7 @@
#include "MMIMessages.h"
namespace uscxml {
-
+
class MMIProtoBridge {
public:
static ::LifeCycleEvent toProto(const NewContextRequest&);
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp
new file mode 100644
index 0000000..da36a17
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp
@@ -0,0 +1,41 @@
+#include <uscxml/Common.h>
+#include "uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h"
+#include "uscxml/Message.h"
+#include <iostream>
+
+#include <string.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool connect(pluma::Host& host) {
+ host.add( new SampleIOProcessorProvider() );
+ return true;
+}
+#endif
+
+SampleIOProcessor::SampleIOProcessor() {
+}
+
+SampleIOProcessor::~SampleIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> SampleIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<SampleIOProcessor> io = boost::shared_ptr<SampleIOProcessor>(new SampleIOProcessor());
+ return io;
+}
+
+Data SampleIOProcessor::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void SampleIOProcessor::send(const SendRequest& req) {
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
new file mode 100644
index 0000000..3a58c13
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
@@ -0,0 +1,39 @@
+#ifndef SAMPLEIOPROCESSOR_H_2CUY93KU
+#define SAMPLEIOPROCESSOR_H_2CUY93KU
+
+#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class SampleIOProcessor : public IOProcessorImpl {
+public:
+ SampleIOProcessor();
+ virtual ~SampleIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("sample");
+ names.insert("http://www.w3.org/TR/scxml/#SampleEventProcessor");
+ return names;
+ }
+
+ virtual void send(const SendRequest& req);
+ Data getDataModelVariables();
+
+protected:
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(SampleIOProcessor, IOProcessorImpl);
+#endif
+
+}
+
+#endif /* end of include guard: SAMPLEIOPROCESSOR_H_2CUY93KU */ \ No newline at end of file
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index bd24326..f4b1a57 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -72,7 +72,10 @@ std::map<std::string, std::string> HTTPServer::mimeTypes;
HTTPServer* HTTPServer::getInstance(int port) {
// tthread::lock_guard<tthread::recursive_mutex> lock(_instanceMutex);
if (_instance == NULL) {
-
+#ifdef _WIN32
+ WSADATA wsaData;
+ WSAStartup(MAKEWORD(2, 2), &wsaData);
+#endif
// this is but a tiny list, supply a content-type <header> yourself
mimeTypes["txt"] = "text/plain";
mimeTypes["c"] = "text/plain";
@@ -109,19 +112,16 @@ std::string HTTPServer::mimeTypeForExtension(const std::string& ext) {
return "";
}
+/**
+ * This callback is registered for all HTTP requests
+ */
void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackData) {
-// std::cout << (uintptr_t)req << ": Replying" << std::endl;
-// evhttp_send_error(req, 404, NULL);
-// return;
-
std::stringstream raw;
evhttp_request_own(req);
Request request;
request.curlReq = req;
-
-
switch (evhttp_request_get_command(req)) {
case EVHTTP_REQ_GET:
request.data.compound["type"] = Data("get", Data::VERBATIM);
@@ -167,7 +167,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
const char* query = evhttp_uri_get_query(evhttp_request_get_evhttp_uri(req));
if (query)
raw << "?" << std::string(query);
-
+
raw << " HTTP/" << request.data.compound["httpMajor"].atom << "." << request.data.compound["httpMinor"].atom;
raw << std::endl;
@@ -237,40 +237,45 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
request.raw = raw.str();
- if (callbackData == NULL) {
+ // try with the handler registered for path first
+ bool answered = false;
+ if (callbackData != NULL)
+ answered = ((HTTPServlet*)callbackData)->httpRecvRequest(request);
+
+ if (!answered)
HTTPServer::getInstance()->processByMatchingServlet(request);
- } else {
- ((HTTPServlet*)callbackData)->httpRecvRequest(request);
- }
}
+
void HTTPServer::processByMatchingServlet(const Request& request) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
servlet_iter_t servletIter = _servlets.begin();
std::string actualPath = request.data.compound.at("path").atom;
- HTTPServlet* bestMatch = NULL;
- std::string bestPath;
+ std::map<std::string, HTTPServlet*, comp_strsize_less> matches;
while(servletIter != _servlets.end()) {
// is the servlet path a prefix of the actual path?
std::string servletPath = "/" + servletIter->first;
if (boost::iequals(actualPath.substr(0, servletPath.length()), servletPath) && // actual path is a prefix
- boost::iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/'
- if (bestPath.length() < servletPath.length()) {
- // this servlet is a better match
- bestPath = servletPath;
- bestMatch = servletIter->second;
- }
+ boost::iequals(actualPath.substr(servletPath.length(), 1), "/")) { // and next character is a '/'
+ matches.insert(std::make_pair(servletPath, servletIter->second));
}
servletIter++;
}
- if (bestMatch != NULL) {
- bestMatch->httpRecvRequest(request);
- } else {
- LOG(INFO) << "Got an HTTP request at " << actualPath << " but no servlet is registered there or at a prefix";
- evhttp_send_error(request.curlReq, 404, NULL);
+ // process by best matching servlet until someone feels responsible
+ std::map<std::string, HTTPServlet*, comp_strsize_less>::iterator matchesIter = matches.begin();
+ while(matchesIter != matches.end()) {
+ if (matchesIter->second->httpRecvRequest(request)) {
+ return;
+ }
+ matchesIter++;
}
+
+ LOG(INFO) << "Got an HTTP request at " << actualPath << " but no servlet is registered there or at a prefix";
+ evhttp_send_error(request.curlReq, 404, NULL);
}
void HTTPServer::reply(const Reply& reply) {
@@ -281,7 +286,6 @@ void HTTPServer::reply(const Reply& reply) {
}
void HTTPServer::replyCallback(evutil_socket_t fd, short what, void *arg) {
-
Reply* reply = (Reply*)arg;
if (reply->content.size() > 0 && reply->headers.find("Content-Type") == reply->headers.end()) {
diff --git a/src/uscxml/server/HTTPServer.h b/src/uscxml/server/HTTPServer.h
index bd54166..d216d5e 100644
--- a/src/uscxml/server/HTTPServer.h
+++ b/src/uscxml/server/HTTPServer.h
@@ -20,7 +20,7 @@ public:
Request() : curlReq(NULL) {}
std::string content;
struct evhttp_request* curlReq;
-
+
operator bool() {
return curlReq != NULL;
}
@@ -50,6 +50,15 @@ public:
static void unregisterServlet(HTTPServlet* servlet);
private:
+ struct comp_strsize_less {
+ bool operator()(std::string const& l, std::string const& r) const {
+ if (l.size() < r.size())
+ return false;
+
+ return l < r;
+ };
+ };
+
HTTPServer(unsigned short port);
~HTTPServer();
@@ -86,11 +95,11 @@ private:
class HTTPServlet {
public:
- virtual void httpRecvRequest(const HTTPServer::Request& request) = 0;
+ virtual bool httpRecvRequest(const HTTPServer::Request& request) = 0;
+ virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
virtual bool canAdaptPath() {
return true;
}
- virtual void setURL(const std::string& url) = 0; /// Called by the server with the actual URL
};
}
diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp
index 28b7c1b..b59cc05 100644
--- a/src/uscxml/server/InterpreterServlet.cpp
+++ b/src/uscxml/server/InterpreterServlet.cpp
@@ -24,7 +24,7 @@ boost::shared_ptr<IOProcessorImpl> InterpreterServlet::create(InterpreterImpl* i
return io;
}
-void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) {
+bool InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) {
tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
// evhttp_request_own(req.curlReq);
@@ -37,6 +37,7 @@ void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) {
event.origin = toStr((uintptr_t)req.curlReq);
event.initContent(event.data.compound["content"].atom);
_interpreter->receive(event);
+ return true;
}
Data InterpreterServlet::getDataModelVariables() {
diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h
index 6c61e47..c00bd11 100644
--- a/src/uscxml/server/InterpreterServlet.h
+++ b/src/uscxml/server/InterpreterServlet.h
@@ -26,7 +26,7 @@ public:
Data getDataModelVariables();
virtual void send(const SendRequest& req);
- virtual void httpRecvRequest(const HTTPServer::Request& req);
+ virtual bool httpRecvRequest(const HTTPServer::Request& req);
std::string getPath() {
return _path;