本文整理汇总了C++中Local::GetFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ Local::GetFunction方法的具体用法?C++ Local::GetFunction怎么用?C++ Local::GetFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Local
的用法示例。
在下文中一共展示了Local::GetFunction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
/*
DESCRIPTION
Init function of the Pool class.
Initiates and maps the functions and properties of Pool class.
*/
void Pool::Init(Handle<Object> target)
{
Nan::HandleScope scope;
Local<FunctionTemplate> temp = Nan::New<FunctionTemplate>(New);
temp->InstanceTemplate()->SetInternalFieldCount(1);
temp->SetClassName(Nan::New<v8::String>("Pool").ToLocalChecked());
Nan::SetPrototypeMethod(temp, "terminate", Terminate);
Nan::SetPrototypeMethod(temp, "getConnection", GetConnection);
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("poolMax").ToLocalChecked(),
Pool::GetPoolMax,
Pool::SetPoolMax );
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("poolMin").ToLocalChecked(),
Pool::GetPoolMin,
Pool::SetPoolMin );
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("poolIncrement").ToLocalChecked(),
Pool::GetPoolIncrement,
Pool::SetPoolIncrement );
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("poolTimeout").ToLocalChecked(),
Pool::GetPoolTimeout,
Pool::SetPoolTimeout );
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("connectionsOpen").ToLocalChecked(),
Pool::GetConnectionsOpen,
Pool::SetConnectionsOpen );
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("connectionsInUse").ToLocalChecked(),
Pool::GetConnectionsInUse,
Pool::SetConnectionsInUse );
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("stmtCacheSize").ToLocalChecked(),
Pool::GetStmtCacheSize,
Pool::SetStmtCacheSize );
poolTemplate_s.Reset( temp );
Nan::Set(target, Nan::New<v8::String>("Pool").ToLocalChecked(), temp->GetFunction());
}
示例2: Init
void Instruction::Init(Handle<Object> target) {
Nan::HandleScope scope;
Local<v8::FunctionTemplate> ctor = Nan::New<v8::FunctionTemplate>(New);
constructor.Reset(ctor);
ctor->Inherit (Nan::New<v8::FunctionTemplate>(Value::constructor));
ctor->InstanceTemplate()->SetInternalFieldCount(1);
ctor->SetClassName(Nan::New("Instruction").ToLocalChecked());
#if false
Nan::SetPrototypeMethod (ctor, "setDebugLoc", Instruction::SetDebugLoc);
#endif
Local<v8::Function> ctor_func = ctor->GetFunction();
constructor_func.Reset(ctor_func);
target->Set(Nan::New("Instruction").ToLocalChecked(), ctor_func);
}
示例3: Init
/*
DESCRIPTION
Init function of the ResultSet class.
Initiates and maps the functions and properties of ResultSet class.
*/
void ResultSet::Init(Handle<Object> target)
{
NanScope();
Local<FunctionTemplate> temp = NanNew<FunctionTemplate>(New);
temp->InstanceTemplate()->SetInternalFieldCount(1);
temp->SetClassName(NanNew<v8::String>("ResultSet"));
NODE_SET_PROTOTYPE_METHOD(temp, "close", Close);
NODE_SET_PROTOTYPE_METHOD(temp, "getRow", GetRow);
NODE_SET_PROTOTYPE_METHOD(temp, "getRows", GetRows);
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("metaData"),
ResultSet::GetMetaData,
ResultSet::SetMetaData );
NanAssignPersistent( resultSetTemplate_s, temp);
target->Set(NanNew<v8::String>("ResultSet"),temp->GetFunction());
}
示例4: Initialize
void Text::Initialize(Handle<Object> target)
{
HandleScope scope;
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
Local<String> name = String::NewSymbol("Text");
/* Methods */
Actor::PrototypeMethodsInit(tpl);
NODE_SET_PROTOTYPE_METHOD(tpl, "setColor", Text::SetColor);
NODE_SET_PROTOTYPE_METHOD(tpl, "getColor", Text::GetColor);
NODE_SET_PROTOTYPE_METHOD(tpl, "setText", Text::SetText);
NODE_SET_PROTOTYPE_METHOD(tpl, "getText", Text::GetText);
NODE_SET_PROTOTYPE_METHOD(tpl, "setFontName", Text::SetFontName);
NODE_SET_PROTOTYPE_METHOD(tpl, "getFontName", Text::GetFontName);
target->Set(name, tpl->GetFunction());
}
示例5: Init
void DIBuilder::Init(Handle<Object> target) {
Nan::HandleScope scope;
Local<v8::FunctionTemplate> ctor = Nan::New<v8::FunctionTemplate>(New);
constructor.Reset(ctor);
ctor->InstanceTemplate()->SetInternalFieldCount(1);
ctor->SetClassName(Nan::New("DIBuilder").ToLocalChecked());
Nan::SetPrototypeMethod(ctor, "createCompileUnit", DIBuilder::CreateCompileUnit);
Nan::SetPrototypeMethod(ctor, "createFile", DIBuilder::CreateFile);
Nan::SetPrototypeMethod(ctor, "createFunction", DIBuilder::CreateFunction);
Nan::SetPrototypeMethod(ctor, "createLexicalBlock", DIBuilder::CreateLexicalBlock);
Nan::SetPrototypeMethod(ctor, "finalize", DIBuilder::Finalize);
Local<v8::Function> ctor_func = ctor->GetFunction();
constructor_func.Reset(ctor_func);
target->Set(Nan::New("DIBuilder").ToLocalChecked(), ctor_func);
}
示例6: Init
void CustomizeTrainingBinding::Init(v8::Handle<Object> target)
{
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("CustomizeTrainingBinding"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetDescriptions"),FunctionTemplate::New(GetDescriptions)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetUIDs"),FunctionTemplate::New(GetUIDs)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetHostile"),FunctionTemplate::New(GetHostile)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetIncluded"),FunctionTemplate::New(SetIncluded)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("Save"),FunctionTemplate::New(Save)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetCaptureIPs"),FunctionTemplate::New(GetCaptureIPs)->GetFunction());
// Prototype
Persistent<Function> constructor = Persistent<Function>::New(tpl->GetFunction());
target->Set(String::NewSymbol("CustomizeTrainingBinding"), constructor);
}
示例7: Init
/*
DESCRIPTION
Init function of the Pool class.
Initiates and maps the functions and properties of Pool class.
*/
void Pool::Init(Handle<Object> target)
{
NanScope();
Local<FunctionTemplate> temp = NanNew<FunctionTemplate>(New);
temp->InstanceTemplate()->SetInternalFieldCount(1);
temp->SetClassName(NanNew<v8::String>("Pool"));
NODE_SET_PROTOTYPE_METHOD(temp, "terminate", Terminate);
NODE_SET_PROTOTYPE_METHOD(temp, "getConnection", GetConnection);
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("poolMax"),
Pool::GetPoolMax,
Pool::SetPoolMax );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("poolMin"),
Pool::GetPoolMin,
Pool::SetPoolMin );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("poolIncrement"),
Pool::GetPoolIncrement,
Pool::SetPoolIncrement );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("poolTimeout"),
Pool::GetPoolTimeout,
Pool::SetPoolTimeout );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("connectionsOpen"),
Pool::GetConnectionsOpen,
Pool::SetConnectionsOpen );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("connectionsInUse"),
Pool::GetConnectionsInUse,
Pool::SetConnectionsInUse );
temp->InstanceTemplate()->SetAccessor(
NanNew<v8::String>("stmtCacheSize"),
Pool::GetStmtCacheSize,
Pool::SetStmtCacheSize );
NanAssignPersistent( poolTemplate_s, temp );
target->Set(NanNew<v8::String>("Pool"),temp->GetFunction());
}
示例8: mongoInject
Handle<Value> mongoInject(const Arguments& args){
jsassert( args.Length() == 1 , "mongoInject takes exactly 1 argument" );
jsassert( args[0]->IsObject() , "mongoInject needs to be passed a prototype" );
Local<v8::Object> o = args[0]->ToObject();
o->Set( String::New( "init" ) , FunctionTemplate::New( mongoInit )->GetFunction() );
o->Set( String::New( "find" ) , FunctionTemplate::New( mongoFind )->GetFunction() );
o->Set( String::New( "insert" ) , FunctionTemplate::New( mongoInsert )->GetFunction() );
o->Set( String::New( "remove" ) , FunctionTemplate::New( mongoRemove )->GetFunction() );
o->Set( String::New( "update" ) , FunctionTemplate::New( mongoUpdate )->GetFunction() );
Local<FunctionTemplate> t = FunctionTemplate::New( internalCursorCons );
t->PrototypeTemplate()->Set( String::New("next") , FunctionTemplate::New( internalCursorNext ) );
t->PrototypeTemplate()->Set( String::New("hasNext") , FunctionTemplate::New( internalCursorHasNext ) );
o->Set( String::New( "internalCursor" ) , t->GetFunction() );
return v8::Undefined();
}
示例9: tryCatch
/* static */
void V8Runtime::bootstrap(Local<Context> context)
{
Isolate* isolate = context->GetIsolate();
EventEmitter::initTemplate(context);
Local<Object> global = Object::New(isolate);
krollGlobalObject.Reset(isolate, global);
Local<Array> mc = Array::New(isolate);
moduleContexts.Reset(isolate, mc);
KrollBindings::initFunctions(global, context);
SetMethod(isolate, global, "log", krollLog);
// Move this into the EventEmitter::initTemplate call?
Local<FunctionTemplate> eect = Local<FunctionTemplate>::New(isolate, EventEmitter::constructorTemplate);
global->Set(NEW_SYMBOL(isolate, "EventEmitter"), eect->GetFunction());
global->Set(NEW_SYMBOL(isolate, "runtime"), STRING_NEW(isolate, "v8"));
global->Set(NEW_SYMBOL(isolate, "DBG"), v8::Boolean::New(isolate, V8Runtime::DBG));
global->Set(NEW_SYMBOL(isolate, "moduleContexts"), mc);
LOG_TIMER(TAG, "Executing kroll.js");
TryCatch tryCatch(isolate);
Local<Value> result = V8Util::executeString(isolate, KrollBindings::getMainSource(isolate), STRING_NEW(isolate, "ti:/kroll.js"));
if (tryCatch.HasCaught()) {
V8Util::reportException(isolate, tryCatch, true);
}
if (!result->IsFunction()) {
LOGF(TAG, "kroll.js result is not a function");
V8Util::reportException(isolate, tryCatch, true);
}
Local<Function> mainFunction = result.As<Function>();
Local<Value> args[] = { global };
mainFunction->Call(context, context->Global(), 1, args);
if (tryCatch.HasCaught()) {
V8Util::reportException(isolate, tryCatch, true);
LOGE(TAG, "Caught exception while bootstrapping Kroll");
}
}
示例10: Init
void ILob::Init(Handle<Object> target)
{
Nan::HandleScope scope;
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(Nan::New<v8::String>("ILob").ToLocalChecked());
Nan::SetPrototypeMethod(tpl, "release", Release);
Nan::SetPrototypeMethod(tpl, "read", Read);
Nan::SetPrototypeMethod(tpl, "write", Write);
Nan::SetAccessor(tpl->InstanceTemplate(),
Nan::New<v8::String>("chunkSize").ToLocalChecked(),
ILob::GetChunkSize,
ILob::SetChunkSize);
Nan::SetAccessor(tpl->InstanceTemplate(),
Nan::New<v8::String>("length").ToLocalChecked(),
ILob::GetLength,
ILob::SetLength);
Nan::SetAccessor(tpl->InstanceTemplate(),
Nan::New<v8::String>("pieceSize").ToLocalChecked(),
ILob::GetPieceSize,
ILob::SetPieceSize);
Nan::SetAccessor(tpl->InstanceTemplate(),
Nan::New<v8::String>("offset").ToLocalChecked(),
ILob::GetOffset,
ILob::SetOffset);
Nan::SetAccessor(tpl->InstanceTemplate(),
Nan::New<v8::String>("type").ToLocalChecked(),
ILob::GetType,
ILob::SetType);
iLobTemplate_s.Reset(tpl);
Nan::Set(target, Nan::New<v8::String>("ILob").ToLocalChecked(), tpl->GetFunction());
}
示例11: Init
void NovaConfigBinding::Init(Handle<Object> target) {
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("NovaConfigBinding"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
tpl->PrototypeTemplate()->Set(String::NewSymbol("ListInterfaces"),FunctionTemplate::New(InvokeWrappedMethod<std::vector<std::string>, NovaConfigBinding, Config, &Config::ListInterfaces>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetGroup"),FunctionTemplate::New(InvokeWrappedMethod<std::string, NovaConfigBinding, Config, &Config::GetGroup>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("ListLoopbacks"),FunctionTemplate::New(InvokeWrappedMethod<std::vector<std::string>, NovaConfigBinding, Config, &Config::ListLoopbacks>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetInterfaces"),FunctionTemplate::New(InvokeWrappedMethod<std::vector<std::string>, NovaConfigBinding, Config, &Config::GetInterfaces>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetDoppelInterface"),FunctionTemplate::New(InvokeWrappedMethod<std::string, NovaConfigBinding, Config, &Config::GetDoppelInterface>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetUseAllInterfacesBinding"),FunctionTemplate::New(InvokeWrappedMethod<std::string, NovaConfigBinding, Config, &Config::GetUseAllInterfacesBinding>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetDoppelInterface"),FunctionTemplate::New(SetDoppelInterface)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("AddIface"),FunctionTemplate::New(AddIface)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetSMTPUseAuth"),FunctionTemplate::New(SetSMTPUseAuth)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("ClearInterfaces"),FunctionTemplate::New(ClearInterfaces)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("UseAllInterfaces"),FunctionTemplate::New(UseAllInterfaces)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetUseAnyLoopback"),FunctionTemplate::New(InvokeWrappedMethod<bool, NovaConfigBinding, Config, &Config::GetUseAnyLoopback>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetGroup"),FunctionTemplate::New(SetGroup)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("UseAnyLoopback"),FunctionTemplate::New(UseAnyLoopback)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("ReadSetting"),FunctionTemplate::New(ReadSetting)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("WriteSetting"),FunctionTemplate::New(WriteSetting)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("ReloadConfiguration"),FunctionTemplate::New(ReloadConfiguration)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetVersionString"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetVersionString>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetPathConfigHoneydHS"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetPathConfigHoneydHS>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetPathHome"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetPathHome>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetPathShared"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetPathShared>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetCurrentConfig"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetCurrentConfig>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetSMTPUser"),FunctionTemplate::New(InvokeWrappedMethod<bool, NovaConfigBinding, Config, std::string, &Config::SetSMTPUser>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetCurrentConfig"),FunctionTemplate::New(InvokeWrappedMethod<bool, NovaConfigBinding, Config, std::string, &Config::SetCurrentConfig>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("SetSMTPPass"),FunctionTemplate::New(InvokeWrappedMethod<bool, NovaConfigBinding, Config, std::string, &Config::SetSMTPPass>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetSMTPUser"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetSMTPUser>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetSMTPPass"),FunctionTemplate::New(InvokeWrappedMethod<string, NovaConfigBinding, Config, &Config::GetSMTPPass>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetSMTPUseAuth"),FunctionTemplate::New(InvokeWrappedMethod<bool, NovaConfigBinding, Config, &Config::GetSMTPUseAuth>));
tpl->PrototypeTemplate()->Set(String::NewSymbol("GetIpAddresses"),FunctionTemplate::New(InvokeMethod<std::vector<std::string>, std::string, Config::GetIpAddresses>));
Persistent<Function> constructor = Persistent<Function>::New(tpl->GetFunction());
target->Set(String::NewSymbol("NovaConfigBinding"), constructor);
}
示例12: AddonInitialize
void AddonInitialize(v8::Handle<v8::Object> target)
{
using namespace v8;
//HandleScope scope;
static Termios termios;
termios.no_canonical();
Terminfo::initialize();
keyinput_symbol = NODE_PSYMBOL("keyinput");
// javascript class Term
Local<FunctionTemplate> t = FunctionTemplate::New(Term::New);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->Inherit(node::EventEmitter::constructor_template);
NODE_SET_PROTOTYPE_METHOD(t, "listen", Term::listen);
NODE_SET_PROTOTYPE_METHOD(t, "tcmd", Term::tcmd);
NODE_SET_PROTOTYPE_METHOD(t, "size", Term::size);
target->Set(String::NewSymbol("Term"), t->GetFunction());
}
示例13: Init
/*
DESCRIPTION
Init function of the ResultSet class.
Initiates and maps the functions and properties of ResultSet class.
*/
void ResultSet::Init(Handle<Object> target)
{
Nan::HandleScope scope;
Local<FunctionTemplate> temp = Nan::New<FunctionTemplate>(New);
temp->InstanceTemplate()->SetInternalFieldCount(1);
temp->SetClassName(Nan::New<v8::String>("ResultSet").ToLocalChecked());
Nan::SetPrototypeMethod(temp, "close", Close);
Nan::SetPrototypeMethod(temp, "getRow", GetRow);
Nan::SetPrototypeMethod(temp, "getRows", GetRows);
Nan::SetAccessor(temp->InstanceTemplate(),
Nan::New<v8::String>("metaData").ToLocalChecked(),
ResultSet::GetMetaData,
ResultSet::SetMetaData );
resultSetTemplate_s.Reset( temp);
Nan::Set(target, Nan::New<v8::String>("ResultSet").ToLocalChecked(),
temp->GetFunction());
}
示例14: Initialize
void Image::Initialize(Handle<Object> target) {
NanScope();
Local<FunctionTemplate> t = NanNew<FunctionTemplate>(New);
NanAssignPersistent(constructor_template, t);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(NanNew<String>("Image"));
NODE_SET_PROTOTYPE_METHOD(t, "unload", unload);
NODE_SET_PROTOTYPE_METHOD(t, "save", save);
NODE_SET_PROTOTYPE_METHOD(t, "saveToMemory", saveToMemory);
NODE_SET_PROTOTYPE_METHOD(t, "convertTo32Bits", convertTo32Bits);
NODE_SET_PROTOTYPE_METHOD(t, "convertTo24Bits", convertTo24Bits);
NODE_SET_PROTOTYPE_METHOD(t, "flipHorizontal", flipHorizontal);
NODE_SET_PROTOTYPE_METHOD(t, "flipVertical", flipVertical);
target->Set(NanNew<String>("Image"), t->GetFunction());
}
示例15: Init
void Tail::Init(Handle<Object> target) {
v8::HandleScope scope;
data_symbol = NODE_PSYMBOL("data");
error_symbol = NODE_PSYMBOL("error");
end_symbol = NODE_PSYMBOL("end");
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("Tail"));
tpl->InstanceTemplate()->SetInternalFieldCount(3);
// Prototype
tpl->InstanceTemplate()->Set(String::NewSymbol("close"), FunctionTemplate::New(close)->GetFunction());
tpl->InstanceTemplate()->SetAccessor(String::NewSymbol("readable"), Tail::GetReadable);
tpl->InstanceTemplate()->SetAccessor(String::NewSymbol("writable"), Tail::GetWritable);
Persistent<Function> constructor = Persistent<Function>::New(tpl->GetFunction());
target->Set(String::NewSymbol("Tail"), constructor);
}