当前位置: 首页>>代码示例>>C++>>正文


C++ Persistent::InstanceTemplate方法代码示例

本文整理汇总了C++中Persistent::InstanceTemplate方法的典型用法代码示例。如果您正苦于以下问题:C++ Persistent::InstanceTemplate方法的具体用法?C++ Persistent::InstanceTemplate怎么用?C++ Persistent::InstanceTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Persistent的用法示例。


在下文中一共展示了Persistent::InstanceTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Initialize

// initialize a JS wrapper around this object
void NodeFSEvents::Initialize(Handle<Object> target)
{
    HandleScope scope;
    emit_sym = NODE_PSYMBOL("emit");
    change_sym = NODE_PSYMBOL("fsevent");
    Local<FunctionTemplate> t = FunctionTemplate::New(NodeFSEvents::New);
    constructor_template = Persistent<FunctionTemplate>::New(t);
    constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
    constructor_template->SetClassName(String::NewSymbol("FSEvents"));
    Local<Function> constructor = constructor_template->GetFunction();

    constructor->Set(String::New("kFSEventStreamEventFlagNone"), Integer::New(0x00000000));
    constructor->Set(String::New("kFSEventStreamEventFlagMustScanSubDirs"), Integer::New(0x00000001));
    constructor->Set(String::New("kFSEventStreamEventFlagUserDropped"), Integer::New(0x00000002));
    constructor->Set(String::New("kFSEventStreamEventFlagKernelDropped"), Integer::New(0x00000004));
    constructor->Set(String::New("kFSEventStreamEventFlagEventIdsWrapped"), Integer::New(0x00000008));
    constructor->Set(String::New("kFSEventStreamEventFlagHistoryDone"), Integer::New(0x00000010));
    constructor->Set(String::New("kFSEventStreamEventFlagRootChanged"), Integer::New(0x00000020));
    constructor->Set(String::New("kFSEventStreamEventFlagMount"), Integer::New(0x00000040));
    constructor->Set(String::New("kFSEventStreamEventFlagUnmount"), Integer::New(0x00000080));
    constructor->Set(String::New("kFSEventStreamEventFlagItemCreated"), Integer::New(0x00000100));
    constructor->Set(String::New("kFSEventStreamEventFlagItemRemoved"), Integer::New(0x00000200));
    constructor->Set(String::New("kFSEventStreamEventFlagItemInodeMetaMod"), Integer::New(0x00000400));
    constructor->Set(String::New("kFSEventStreamEventFlagItemRenamed"), Integer::New(0x00000800));
    constructor->Set(String::New("kFSEventStreamEventFlagItemModified"), Integer::New(0x00001000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemFinderInfoMod"), Integer::New(0x00002000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemChangeOwner"), Integer::New(0x00004000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemXattrMod"), Integer::New(0x00008000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemIsFile"), Integer::New(0x00010000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemIsDir"), Integer::New(0x00020000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemIsSymlink"), Integer::New(0x00040000));

    target->Set(String::NewSymbol("FSEvents"), constructor);
}
开发者ID:Coachqandtybo2,项目名称:brackets,代码行数:35,代码来源:fsevents_win.cpp

示例2: Initialize

void Query::Initialize(Handle<Object> target) {
    HandleScope scope;
    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Query::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("Query"));
    target->Set(String::NewSymbol("Query"),constructor->GetFunction());
}
开发者ID:F4-Group,项目名称:node-osrm,代码行数:7,代码来源:query.hpp

示例3: Initialize

void Engine::Initialize(Handle<Object> target) {
    HandleScope scope;
    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Engine::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("Engine"));
    NODE_SET_PROTOTYPE_METHOD(constructor, "run", run);
    NODE_SET_PROTOTYPE_METHOD(constructor, "runSync", run);
    target->Set(String::NewSymbol("Engine"),constructor->GetFunction());
}
开发者ID:jfirebaugh,项目名称:node-OSRM,代码行数:9,代码来源:engine.hpp

示例4:

Handle<Value> ShaderBindings_WrapShader(Shader* toWrap) {
    static Persistent<FunctionTemplate> s_templ = Persistent<FunctionTemplate>::New(fl_shad_GetTemplate());
    HandleScope handle_scope;
    Locker locker;
    Local<Object> texture_inst = s_templ->InstanceTemplate()->NewInstance();
    texture_inst->SetInternalField(0, External::New(toWrap));
    Persistent<Object> ref = Persistent<Object>::New(texture_inst->ToObject());
    toWrap->SetWrappedObject(ref);
    return handle_scope.Close(texture_inst);
}
开发者ID:rje,项目名称:flatland,代码行数:10,代码来源:ShaderBindings.cpp

示例5: Init

  static void Init(Handle<Object> target)
  {
    s_ct = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("HelloWorld"));

    NODE_SET_PROTOTYPE_METHOD(s_ct, "hi", Hello);

    target->Set(String::NewSymbol("HelloWorld"),
                s_ct->GetFunction());
  }
开发者ID:oschrenk,项目名称:node-hello-extension,代码行数:11,代码来源:helloworld.cpp

示例6: Init

        static void Init(Handle<Object> target)
        {
            s_ct = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
            s_ct->InstanceTemplate()->SetInternalFieldCount(1);
            s_ct->SetClassName(String::NewSymbol("Scws"));

            // bind methods
            NODE_SET_PROTOTYPE_METHOD(s_ct, "segment", segment);


            // expose class as Scws
            target->Set(String::NewSymbol("Scws"), s_ct->GetFunction());
        }
开发者ID:yiyangest,项目名称:node-extension-example,代码行数:13,代码来源:scws.cpp

示例7: Init

    static void Init(Handle<Object> target) {
        HandleScope scope;

        Local<FunctionTemplate> t = FunctionTemplate::New(New);

        s_ct = Persistent<FunctionTemplate>::New(t);
        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
        s_ct->SetClassName(String::NewSymbol("Lucene"));

        NODE_SET_PROTOTYPE_METHOD(s_ct, "addDocument", AddDocumentAsync);
        NODE_SET_PROTOTYPE_METHOD(s_ct, "search", SearchAsync);

        target->Set(String::NewSymbol("Lucene"), s_ct->GetFunction());
    }
开发者ID:temas,项目名称:node-lucene,代码行数:14,代码来源:clucene_bindings.cpp

示例8: Initialize

void NodeRTree::Initialize(Handle<Object> target) {
    HandleScope scope;

    Local<FunctionTemplate> t = FunctionTemplate::New(New);

    s_ct = Persistent<FunctionTemplate>::New(t);
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("RTree"));

    NODE_SET_PROTOTYPE_METHOD(s_ct, "insertData", InsertData);

    target->Set(String::NewSymbol("RTree"), s_ct->GetFunction());

}
开发者ID:booo,项目名称:node-spatialindex,代码行数:14,代码来源:rtree.cpp

示例9: Init

	static void Init(Handle<Object> target){
		HandleScope scope;

		Local<FunctionTemplate> t = FunctionTemplate::New(New);

		s_ct = Persistent<FunctionTemplate>::New(t);
		s_ct->InstanceTemplate()->SetInternalFieldCount(1);
		s_ct->SetClassName(String::NewSymbol("Connection"));

		NODE_SET_PROTOTYPE_METHOD(s_ct, "Connect", Connect);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "Subscribe", Subscribe);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "Publish", Publish);

		target->Set(String::NewSymbol("Connection"), s_ct->GetFunction());
	}
开发者ID:vollemj,项目名称:gmsec-js,代码行数:15,代码来源:GMSEC.cpp

示例10: Initialize

void NodeFFT::Initialize (Handle<Object> target) {
	HandleScope scope;

	Local<FunctionTemplate> t = FunctionTemplate::New(New);
	fft_constructor_template = Persistent<FunctionTemplate>::New(t);
	fft_constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
	fft_constructor_template->SetClassName(String::NewSymbol("FFT"));

	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "forward", Forward);
	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "forwardCplx", ForwardCplx);
	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "inverse", Forward);
	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "inverseCplx", InverseCplx);

	target->Set(String::NewSymbol("FFT"), fft_constructor_template->GetFunction());
}
开发者ID:EQ4,项目名称:node-dsp,代码行数:15,代码来源:fft.cpp

示例11: Init

    static void Init(Handle<Object> target) {
        PRINTF("Entering Init\n");
        PRINTF("EV_DEFAULT_ = %s\n", TEST_EV_DEFAULT_NAME);
        HandleScope scope;
        
        Local<FunctionTemplate> t = FunctionTemplate::New(New);
        ct = Persistent<FunctionTemplate>::New(t);
        ct->InstanceTemplate()->SetInternalFieldCount(1);
        ct->SetClassName(String::NewSymbol("Pollpri"));
        target->Set(String::NewSymbol("Pollpri"), ct->GetFunction());
        
        target->Set(String::NewSymbol("delay"), 
            FunctionTemplate::New(delay)->GetFunction());

        PRINTF("Leaving Init\n");
    }
开发者ID:KiL89,项目名称:bonescript,代码行数:16,代码来源:misc.cpp

示例12: Initialize

	void QuickWindowWrap::Initialize(Handle<Object> target)
	{
		HandleScope scope;

		Local<String> name = String::NewSymbol("QuickWindow");

		/* Constructor template */
		Persistent<FunctionTemplate> tpl = Persistent<FunctionTemplate>::New(FunctionTemplate::New(QuickWindowWrap::New));
		tpl->InstanceTemplate()->SetInternalFieldCount(1);  
		tpl->SetClassName(name);

		/* Prototype */
		NODE_SET_PROTOTYPE_METHOD(tpl, "show", QuickWindowWrap::show);
		NODE_SET_PROTOTYPE_METHOD(tpl, "toObject", QuickWindowWrap::toObject);

		constructor = Persistent<Function>::New(tpl->GetFunction());

		target->Set(name, constructor);
	}
开发者ID:swhgoon,项目名称:brig,代码行数:19,代码来源:quickwindow.cpp

示例13: Init

void Protobuf::Init(Handle<Object> exports) {
	// Prepare constructor template
	Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
	tpl->SetClassName(String::NewSymbol("Protobuf"));
	tpl->InstanceTemplate()->SetInternalFieldCount(2);

	// Prototype
	tpl->PrototypeTemplate()->Set(String::NewSymbol("Serialize"), FunctionTemplate::New(Serialize)->GetFunction());
	tpl->PrototypeTemplate()->Set(String::NewSymbol("Parse"), FunctionTemplate::New(Parse)->GetFunction());
	tpl->PrototypeTemplate()->Set(String::NewSymbol("MessageHandle"), FunctionTemplate::New(MessageHandle)->GetFunction());

	Persistent<Function> constructor = Persistent<Function>::New(tpl->GetFunction());
	exports->Set(String::NewSymbol("Protobuf"), constructor);

	KeySymbol = NODE_PSYMBOL("Key");
	ValueSymbol = NODE_PSYMBOL("Value");

	TypeTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New());
    TypeTemplate->InstanceTemplate()->SetInternalFieldCount(4);
}
开发者ID:ftcaicai,项目名称:GOD,代码行数:20,代码来源:protobuf.cpp

示例14: Init

    static void NODE_EXTERN Init(Handle<Object> target)
    {
        HandleScope scope;

        // set the constructor function
        Local<FunctionTemplate> t = FunctionTemplate::New(New);

        // set the node.js/v8 class name
        s_ct = Persistent<FunctionTemplate>::New(t);
        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
        s_ct->SetClassName(String::NewSymbol("SharpObject"));

        // registers a class member functions 
        NODE_SET_PROTOTYPE_METHOD(s_ct, "async", Async);
        NODE_SET_PROTOTYPE_METHOD(s_ct, "async2", Async2);
        NODE_SET_PROTOTYPE_METHOD(s_ct, "getSharpValue", GetSharpValue);

        target->Set(String::NewSymbol("SharpObject"),
            s_ct->GetFunction());
    }
开发者ID:JohnLou,项目名称:node.net,代码行数:20,代码来源:SharpAddon.cpp

示例15: Init

    static void NODE_EXTERN Init(Handle<Object> target)
    {
        HandleScope scope;

        // set the constructor function
        Local<FunctionTemplate> t = FunctionTemplate::New(New);

        // set the node.js/v8 class name
        s_ct = Persistent<FunctionTemplate>::New(t);
        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
        s_ct->SetClassName(String::NewSymbol("tsqlftw"));

        // registers a class member functions 
        NODE_SET_PROTOTYPE_METHOD(s_ct, "connect", connect);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "query", query);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "close", close);

        target->Set(String::NewSymbol("tsqlftw"),
            s_ct->GetFunction());
    }
开发者ID:Oprusko,项目名称:tsqlftw,代码行数:20,代码来源:tsqlftw.cpp


注:本文中的Persistent::InstanceTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。