diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-20 17:18:19 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-20 17:18:19 (GMT) |
commit | f4f05b40c8c464daf1e11df6fcdb63d05766ed1f (patch) | |
tree | a513019b456be25248212ab9d722e9c7bb5fdbc2 /src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp | |
parent | b5c33505b3345795811b4aba7e5fda961068f369 (diff) | |
download | uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.zip uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.tar.gz uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.tar.bz2 |
Completed V8 IDL to DOM generator
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp new file mode 100644 index 0000000..58e4ab6 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp @@ -0,0 +1,79 @@ +#include "V8DocumentType.h" +#include "V8NamedNodeMap.h" +#include "V8Node.h" + +namespace Arabica { +namespace DOM { + + 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(); + V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->arabicaThis->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(); + V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); + Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getEntities()); + + v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); + + V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor); + return arbaicaRetObj; + + } + + v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); + Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getNotations()); + + v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); + + V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor); + return arbaicaRetObj; + + } + + v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->arabicaThis->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(); + V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->arabicaThis->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(); + V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->arabicaThis->getInternalSubset().c_str()); + } + bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); + } + +} +} |