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/V8Attr.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/V8Attr.cpp')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp new file mode 100644 index 0000000..d1c2f8f --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp @@ -0,0 +1,61 @@ +#include "V8Attr.h" +#include "V8Element.h" +#include "V8Node.h" + +namespace Arabica { +namespace DOM { + + 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(); + V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->arabicaThis->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(); + V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); + + return v8::Boolean::New(privData->arabicaThis->getSpecified()); + } + + v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->arabicaThis->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(); + V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); + v8::String::AsciiValue localValue(value); + privData->arabicaThis->setValue(*localValue); + } + + v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); + Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getOwnerElement()); + + v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); + + V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + 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); + } + +} +} |