void OSMNodeWrap::Initialize(v8::Handle<v8::Object> target) { v8::HandleScope scope; constructor = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(OSMNodeWrap::New)); constructor->Inherit(OSMObjectWrap::constructor); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(v8::String::NewSymbol("Node")); node::SetPrototypeMethod(constructor, "wkb", wkb); node::SetPrototypeMethod(constructor, "wkt", wkt); auto attributes = static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); set_accessor(constructor, "location", get_coordinates, attributes); set_accessor(constructor, "coordinates", get_coordinates, attributes); set_accessor(constructor, "lon", get_lon, attributes); set_accessor(constructor, "lat", get_lat, attributes); target->Set(v8::String::NewSymbol("Node"), constructor->GetFunction()); }
void default_protocol::init( protocol_accessor *pa, system_closure_type cb ) { process_stage_ = vtrc::bind( &default_protocol::ready_call, this ); set_accessor( pa ); pa->ready( true ); cb( VTRC_SYSTEM::error_code( ) ); }
void OSMChangesetWrap::Initialize(v8::Handle<v8::Object> target) { v8::HandleScope scope; constructor = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(OSMChangesetWrap::New)); constructor->Inherit(OSMEntityWrap::constructor); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(symbol_Changeset); auto attributes = static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); set_accessor(constructor, "type", get_type, attributes); set_accessor(constructor, "id", get_id, attributes); set_accessor(constructor, "uid", get_uid, attributes); set_accessor(constructor, "user", get_user, attributes); set_accessor(constructor, "num_changes", get_num_changes, attributes); set_accessor(constructor, "created_at_seconds_since_epoch", get_created_at, attributes); set_accessor(constructor, "closed_at_seconds_since_epoch", get_closed_at, attributes); set_accessor(constructor, "open", get_open, attributes); set_accessor(constructor, "closed", get_closed, attributes); set_accessor(constructor, "bounds", get_bounds, attributes); node::SetPrototypeMethod(constructor, "tags", tags); target->Set(symbol_Changeset, constructor->GetFunction()); }
void plugins_context::set_accessor_int(const std::string & name, std::function<int(config)> func) { set_accessor(name, [func, name](const config& cfg) { return config {name, func(cfg)}; }); }