本文整理汇总了C++中v8::Persistent::SetClassName方法的典型用法代码示例。如果您正苦于以下问题:C++ Persistent::SetClassName方法的具体用法?C++ Persistent::SetClassName怎么用?C++ Persistent::SetClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类v8::Persistent
的用法示例。
在下文中一共展示了Persistent::SetClassName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureTemplate
v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate> desc,
const char *interfaceName,
v8::Persistent<v8::FunctionTemplate> parentClass,
int fieldCount,
const BatchedAttribute* attributes,
size_t attributeCount,
const BatchedCallback* callbacks,
size_t callbackCount)
{
desc->SetClassName(v8::String::New(interfaceName));
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
instance->SetInternalFieldCount(fieldCount);
if (!parentClass.IsEmpty())
desc->Inherit(parentClass);
if (attributeCount)
batchConfigureAttributes(instance, desc->PrototypeTemplate(),
attributes, attributeCount);
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(desc);
if (callbackCount)
batchConfigureCallbacks(desc->PrototypeTemplate(),
defaultSignature,
static_cast<v8::PropertyAttribute>(v8::DontDelete),
callbacks, callbackCount);
return defaultSignature;
}
示例2: Init
void XpcConnection::Init(v8::Handle<v8::Object> target) {
v8::HandleScope scope;
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(XpcConnection::New);
s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
s_ct->InstanceTemplate()->SetInternalFieldCount(1);
s_ct->SetClassName(v8::String::NewSymbol("XpcConnection"));
NODE_SET_PROTOTYPE_METHOD(s_ct, "setup", XpcConnection::Setup);
NODE_SET_PROTOTYPE_METHOD(s_ct, "sendMessage", XpcConnection::SendMessage);
target->Set(v8::String::NewSymbol("XpcConnection"), s_ct->GetFunction());
}
示例3: batchConfigureAttributes
v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Persistent<v8::FunctionTemplate> parentClass,
size_t fieldCount, const BatchedAttribute* attributes, size_t attributeCount, const BatchedCallback* callbacks, size_t callbackCount, v8::Isolate* isolate)
{
functionDescriptor->SetClassName(v8::String::NewSymbol(interfaceName));
v8::Local<v8::ObjectTemplate> instance = functionDescriptor->InstanceTemplate();
instance->SetInternalFieldCount(fieldCount);
if (!parentClass.IsEmpty())
functionDescriptor->Inherit(parentClass);
if (attributeCount)
batchConfigureAttributes(instance, functionDescriptor->PrototypeTemplate(), attributes, attributeCount, isolate);
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(functionDescriptor);
if (callbackCount)
batchConfigureCallbacks(functionDescriptor->PrototypeTemplate(), defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callbackCount, isolate);
return defaultSignature;
}
示例4: Initialize
static void Initialize () {
// instantiate constructor template
Local<FunctionTemplate> t = FunctionTemplate::New(New);
// set properties
t->InstanceTemplate()->Set(String::NewSymbol("BYTES_PER_ELEMENT"), v8::Uint32::New(4));
t->SetClassName(String::New("Int32Array"));
t->InstanceTemplate()->SetInternalFieldCount(1);
// t->InstanceTemplate()->SetAccessor(String::New("learning_momentum"), GetLearningMomentum, SetLearningMomentum);
// member method prototypes
Local<Function> getFunc=v8::FunctionTemplate::New(Int32Array::get)->GetFunction();
getFunc->SetName(v8::String::NewSymbol("get"));
t->InstanceTemplate()->Set(v8::String::NewSymbol("get"), getFunc);
Local<Function> setFunc=v8::FunctionTemplate::New(Int32Array::set)->GetFunction();
setFunc->SetName(v8::String::NewSymbol("set"));
t->InstanceTemplate()->Set(v8::String::NewSymbol("set"), setFunc);
Local<Function> sliceFunc=v8::FunctionTemplate::New(Int32Array::slice)->GetFunction();
sliceFunc->SetName(v8::String::NewSymbol("slice"));
t->InstanceTemplate()->Set(v8::String::NewSymbol("slice"), sliceFunc);
Local<Function> subarrayFunc=v8::FunctionTemplate::New(Int32Array::subarray)->GetFunction();
subarrayFunc->SetName(v8::String::NewSymbol("subarray"));
t->InstanceTemplate()->Set(v8::String::NewSymbol("subarray"), subarrayFunc);
// NODE_SET_METHOD(t->InstanceTemplate(), "get", get);
// NODE_SET_METHOD(t->InstanceTemplate(), "set", get);
// NODE_SET_METHOD(t->InstanceTemplate(), "slice", slice);
// NODE_SET_METHOD(t->InstanceTemplate(), "subarray", subarray);
// NODE_SET_PROTOTYPE_METHOD(t, "length", length);
// initialize constructor reference
// std::cout<<"Int32Array Constructor "<<std::endl;
Constructor=Persistent<FunctionTemplate>::New(t);
// std::cout<<"create "<<std::endl;
Constructor->SetClassName(String::NewSymbol("Int32Array"));
// Constructor->InstanceTemplate()->Set(String::NewSymbol("BYTES_PER_ELEMENT"), v8::Uint32::New(4));
// NODE_SET_METHOD(Constructor->InstanceTemplate(), "get", get);
// NODE_SET_PROTOTYPE_METHOD(Constructor, "set", get);
// NODE_SET_PROTOTYPE_METHOD(Constructor, "slice", slice);
// NODE_SET_PROTOTYPE_METHOD(Constructor, "subarray", subarray);
//
// // object has one internal filed ( the C++ object)
Constructor->InstanceTemplate()->SetInternalFieldCount(1);
// std::cout<<"created "<<std::endl;
}
示例5: Init
static void Init(v8::Handle<v8::Object> target)
{
v8::HandleScope scope;
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
s_ct->InstanceTemplate()->SetInternalFieldCount(1);
s_ct->SetClassName(v8::String::NewSymbol("NodeMidiOutput"));
NODE_SET_PROTOTYPE_METHOD(s_ct, "getPortCount", GetPortCount);
NODE_SET_PROTOTYPE_METHOD(s_ct, "getPortName", GetPortName);
NODE_SET_PROTOTYPE_METHOD(s_ct, "openPort", OpenPort);
NODE_SET_PROTOTYPE_METHOD(s_ct, "openVirtualPort", OpenVirtualPort);
NODE_SET_PROTOTYPE_METHOD(s_ct, "closePort", ClosePort);
NODE_SET_PROTOTYPE_METHOD(s_ct, "sendMessage", SendMessage);
target->Set(v8::String::NewSymbol("output"),
s_ct->GetFunction());
}