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


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

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


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

示例1: ScanHelper_initOnLoad

void ScanHelper_initOnLoad(Handle<Object> target) {
  Persistent<Object> scanObj = Persistent<Object>(Object::New());
  Persistent<String> scanKey = Persistent<String>(String::NewSymbol("Scan"));
  target->Set(scanKey, scanObj);

  DEFINE_JS_FUNCTION(scanObj, "create", DBScanHelper_wrapper);

  Persistent<Object> ScanHelper = Persistent<Object>(Object::New());
  Persistent<Object> ScanFlags = Persistent<Object>(Object::New());
  
  scanObj->Set(Persistent<String>(String::NewSymbol("helper")), ScanHelper);
  scanObj->Set(Persistent<String>(String::NewSymbol("flags")), ScanFlags);

  WRAP_CONSTANT(ScanFlags, SF_TupScan);
  WRAP_CONSTANT(ScanFlags, SF_DiskScan);
  WRAP_CONSTANT(ScanFlags, SF_OrderBy);
  WRAP_CONSTANT(ScanFlags, SF_OrderByFull);
  WRAP_CONSTANT(ScanFlags, SF_Descending);
  WRAP_CONSTANT(ScanFlags, SF_ReadRangeNo);
  WRAP_CONSTANT(ScanFlags, SF_MultiRange);
  WRAP_CONSTANT(ScanFlags, SF_KeyInfo);
  
  DEFINE_JS_INT(ScanHelper, "table_record", SCAN_TABLE_RECORD);
  DEFINE_JS_INT(ScanHelper, "index_record", SCAN_INDEX_RECORD);
  DEFINE_JS_INT(ScanHelper, "lock_mode", SCAN_LOCK_MODE);
  DEFINE_JS_INT(ScanHelper, "bounds", SCAN_BOUNDS);
  DEFINE_JS_INT(ScanHelper, "flags", SCAN_OPTION_FLAGS);
  DEFINE_JS_INT(ScanHelper, "batch_size", SCAN_OPTION_BATCH_SIZE);
  DEFINE_JS_INT(ScanHelper, "parallel", SCAN_OPTION_PARALLELISM);
  DEFINE_JS_INT(ScanHelper, "filter_code", SCAN_FILTER_CODE);
}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:31,代码来源:DBScanHelper.cpp

示例2: Init

void Init (Handle<Object> target) {
  
  initQueues();
  freeThreadsQueue= nuQueue(-3); //闲置线程队列的 id为 -3
  freeJobsQueue= nuQueue(-4); //闲置任务队列的id 为-4
  
  HandleScope scope;
  
  //static bool   IsActive ()
  //将返回当前V8的运行实例是否加锁
  useLocker= v8::Locker::IsActive(); 
  

  target->Set(String::NewSymbol("create"), FunctionTemplate::New(Create)->GetFunction());
  target->Set(String::NewSymbol("createPool"), Script::Compile(String::New(kCreatePool_js))->Run()->ToObject());
  //target->Set(String::NewSymbol("JASON"), Script::Compile(String::New(kJASON_js))->Run()->ToObject());
  
  //设置js访问线程id的属性名为‘id’
  id_symbol= Persistent<String>::New(String::NewSymbol("id"));
  
  //定义 threadTemplate 的一些属性
  threadTemplate= Persistent<ObjectTemplate>::New(ObjectTemplate::New());
  threadTemplate->SetInternalFieldCount(1);
  threadTemplate->Set(id_symbol, Integer::New(0));
  threadTemplate->Set(String::NewSymbol("eval"), FunctionTemplate::New(Eval));
  //threadTemplate->Set(String::NewSymbol("load"), FunctionTemplate::New(Load));
  threadTemplate->Set(String::NewSymbol("emit"), FunctionTemplate::New(processEmit));
  threadTemplate->Set(String::NewSymbol("destroy"), FunctionTemplate::New(Destroy));
}
开发者ID:bamwang,项目名称:auto_scaling_for_node,代码行数:29,代码来源:threads_a_gogo.cpp

示例3: context_scope

extern "C" Handle<Value> makeException(Persistent<Context> context, Handle<Array> array) {
    HandleScope handle_scope;
    Context::Scope context_scope(context);
    Persistent<Object> exception = Persistent<Object>::New(Object::New());
    exception->Set(String::New("Message"), String::New("An F# exception occurred"));
    exception->Set(String::New("Values"), array);
    Persistent<Value> result = Persistent<Value>::New(exception);
    return result;
}
开发者ID:edumunoz,项目名称:MiXture,代码行数:9,代码来源:v8_helper.cpp

示例4: init_global_object

void init_global_object () {
    globalObject = Persistent<ObjectTemplate>::New(ObjectTemplate::New());
    builtinObject = Persistent<ObjectTemplate>::New(ObjectTemplate::New());

    init_buffer_object();
    init_console_object();
    init_process_object();
    init_net_object();
    init_http_object();
    init_fs_object();
    init_v8_object();
    init_popen_object();
    init_async_object();
    init_time_object();

#if !BOOTSTRAP_SILKJS
    init_logfile_object();
    init_sem_object();
    init_mysql_object();
    init_sqlite3_object();
    init_memcached_object();
    init_gd_object();
    init_ncurses_object();
    init_curl_object();
    init_xhrHelper_object();
    init_ssh_object();
    init_sftp_object();
    init_ftp_object();
    init_editline_object();
    init_cairo_object();
    init_expat_object();
#endif
    globalObject->Set(String::New("builtin"), builtinObject);
    globalObject->Set(String::New("log"), FunctionTemplate::New(Log));
    globalObject->Set(String::New("print"), FunctionTemplate::New(Print));
    globalObject->Set(String::New("println"), FunctionTemplate::New(Println));
    globalObject->Set(String::New("include"), FunctionTemplate::New(Include));
    globalObject->Set(String::New("loadDll"), FunctionTemplate::New(LoadLibrary));
}
开发者ID:amigrave,项目名称:SilkJS,代码行数:39,代码来源:global.cpp

示例5: IndexBound_initOnLoad

void IndexBound_initOnLoad(Handle<Object> target) {
    Persistent<Object> ibObj = Persistent<Object>(Object::New());
    Persistent<String> ibKey = Persistent<String>(String::NewSymbol("IndexBound"));
    target->Set(ibKey, ibObj);

    DEFINE_JS_FUNCTION(ibObj, "create", newIndexBound);

    Persistent<Object> BoundHelper = Persistent<Object>(Object::New());
    ibObj->Set(Persistent<String>(String::NewSymbol("helper")), BoundHelper);

    DEFINE_JS_INT(BoundHelper, "low_key", BOUND_LOW_KEY);
    DEFINE_JS_INT(BoundHelper, "low_key_count", BOUND_LOW_KEY_COUNT);
    DEFINE_JS_INT(BoundHelper, "low_inclusive", BOUND_LOW_INCLUSIVE);
    DEFINE_JS_INT(BoundHelper, "high_key", BOUND_HIGH_KEY);
    DEFINE_JS_INT(BoundHelper, "high_key_count", BOUND_HIGH_KEY_COUNT);
    DEFINE_JS_INT(BoundHelper, "high_inclusive", BOUND_HIGH_INCLUSIVE);
    DEFINE_JS_INT(BoundHelper, "range_no", BOUND_RANGE_NO);
}
开发者ID:WhiteWaterCoder,项目名称:mysql-js,代码行数:18,代码来源:IndexBoundHelper.cpp

示例6: ThrowException

static Handle<Value> TitaniumCountlyAndroidMessaging_getBinding(const Arguments& args)
{
	HandleScope scope;

	if (args.Length() == 0) {
		return ThrowException(Exception::Error(String::New("TitaniumCountlyAndroidMessaging.getBinding requires 1 argument: binding")));
	}

	if (bindingCache.IsEmpty()) {
		bindingCache = Persistent<Object>::New(Object::New());
	}

	Handle<String> binding = args[0]->ToString();

	if (bindingCache->Has(binding)) {
		return bindingCache->Get(binding);
	}

	String::Utf8Value bindingValue(binding);

	LOGD(TAG, "Looking up binding: %s", *bindingValue);

	titanium::bindings::BindEntry *extBinding = ::TitaniumCountlyAndroidMessagingBindings::lookupGeneratedInit(
		*bindingValue, bindingValue.length());

	if (!extBinding) {
		LOGE(TAG, "Couldn't find binding: %s, returning undefined", *bindingValue);
		return Undefined();
	}

	Handle<Object> exports = Object::New();
	extBinding->bind(exports);
	bindingCache->Set(binding, exports);

	return exports;
}
开发者ID:Arthien,项目名称:countly-sdk-appcelerator-titanium-android,代码行数:36,代码来源:TitaniumCountlyAndroidMessagingBootstrap.cpp


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