#include "globals.h" #include "ControlFieldState_v8_wrapper.h" #include #include "ControlFieldState.h" #include using namespace v8; #ifdef UNICODE # define V8_TCHAR uint16_t #else # define V8_TCHAR char #endif static Handle Get_ControlFieldState_text(Local property, const AccessorInfo &info) { HandleScope scope; Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) return scope.Close( Undefined() ); ControlFieldState *tmp = (ControlFieldState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( String::New((const V8_TCHAR *) tmp->getText()) ); } static void Set_ControlFieldState_text(Local property, Local value, const AccessorInfo& info) { HandleScope scope; Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) return; ControlFieldState *tmp = (ControlFieldState *) wrap->Value(); if (tmp == NULL) return; if (!value.IsEmpty() && value->IsString()) { String::Utf8Value utf8_value(value); tmp->setText(Utf8ToTchar(*utf8_value)); } } void AddControlFieldStateAcessors(Handle &templ) { HandleScope scope; templ->SetAccessor(String::New("text"), Get_ControlFieldState_text, Set_ControlFieldState_text); }