本文整理汇总了C++中Handle::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::Get方法的具体用法?C++ Handle::Get怎么用?C++ Handle::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Handle
的用法示例。
在下文中一共展示了Handle::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _memcached_mget
/**
* @function memcached.mget
*
* ### Synopsis:
*
* var o = memcache.get(handle, array_of_keys);
*
* Get multiple values, identified by an array of keys, from memcached.
*
* The returned object is a hash of returned values, indexed by the key.
*
* For each of these keys, the value is an object in the form described at the top of this page.
*
* @param {object} handle - handle to memcached connection.
* @param {array} keys - array of keys of data to get from memcached
* @return {object} o - has of objects of the form described at top of the page, or false if an error occurred.
*/
JSVAL _memcached_mget (JSARGS args) {
HandleScope scope;
M* handle = HANDLE(args[0]);
Handle<Array> aKeys = Handle<Array>::Cast(args[1]);
int numKeys = aKeys->Length();
char *keys[numKeys];
size_t key_lengths[numKeys];
for (int i = 0; i < numKeys; i++) {
String::Utf8Value k(aKeys->Get(i));
keys[i] = *k;
key_lengths[i] = strlen(keys[i]);
}
R rc = memcached_mget(handle, keys, key_lengths, numKeys);
if (rc != MEMCACHED_SUCCESS) {
return String::New(memcached_strerror(handle, rc));
}
char return_key[MEMCACHED_MAX_KEY];
size_t return_key_length;
char *return_value;
size_t return_value_length;
uint32_t flags;
JSOBJ result = Object::New();
while ((return_value = memcached_fetch(handle, return_key, &return_key_length, &return_value_length, &flags, &rc))) {
JSOBJ o = Object::New();
o->Set(String::New("value"), String::New(return_value));
o->Set(String::New("flags"), Integer::New(flags));
o->Set(String::New("rc"), Integer::New(rc));
free(return_value);
result->Set(String::New(return_key), o);
}
return scope.Close(result);
}
示例2: DBOperationHelper_NonVO
void DBOperationHelper_NonVO(Handle<Object> spec, KeyOperation & op) {
HandleScope scope;
Local<Value> v;
Local<Object> o;
setKeysInOp(spec, op);
v = spec->Get(HELPER_ROW_BUFFER);
if(! v->IsNull()) {
o = v->ToObject();
op.row_buffer = V8BINDER_UNWRAP_BUFFER(o);
}
v = spec->Get(HELPER_ROW_RECORD);
if(! v->IsNull()) {
o = v->ToObject();
const Record * record = unwrapPointer<const Record *>(o);
op.row_record = record;
v = spec->Get(HELPER_BLOBS);
if(v->IsObject()) {
if(op.opcode == 1) {
createBlobReadHandles(v->ToObject(), record, op);
} else {
createBlobWriteHandles(v->ToObject(), record, op);
}
}
}
v = spec->Get(HELPER_LOCK_MODE);
if(! v->IsNull()) {
int intLockMode = v->Int32Value();
op.lmode = static_cast<NdbOperation::LockMode>(intLockMode);
}
v = spec->Get(HELPER_COLUMN_MASK);
if(! v->IsNull()) {
Array *maskArray = Array::Cast(*v);
for(unsigned int m = 0 ; m < maskArray->Length() ; m++) {
Local<Value> colId = maskArray->Get(m);
op.useColumn(colId->Int32Value());
}
}
DEBUG_PRINT("Non-VO opcode: %d mask: %u", op.opcode, op.u.maskvalue);
}
示例3: get_env
static string get_env(Handle<Function> require) {
HandleScope hs;
Handle<Object> env = Handle<Object>::Cast(Context::GetCalling()->Global()->Get(String::New("_env")));
if(env->IsUndefined()) return "/usr/lib/purple/js";
String::Utf8Value cwd (env->Get(String::New("cwd")));
cerr << "found cwd = " << *cwd << endl;
return string(*cwd);
}
示例4: loadComponent
//*]}//*
void loadComponent(cs::StringList& sl,LPCWSTR modeList,LPCWSTR component,Handle<Object>& glb,LPCWSTR checkName,LOADJSCOMPONENT loadc){
if(strIsNull(modeList)||sl.IndexOf(component)!=-1){
//检测此dll是否已经加载过了.
Local<Value> vp = glb->Get(String::New((uint16_t*)checkName));
if(vp->IsUndefined())
loadc(glb);
}
}
示例5: js2hash
void js2hash(Handle<Object> obj, hash& h){
Handle<Array> hash1 = Handle<Array>::Cast(obj->Get(String::New("major_hash")));
for (int i = 0; i < HASH1NUMBINS; i++)
h.hist_major[i]= (float)hash1->Get(i)->ToNumber()->NumberValue();
//Handle <Array> hash2 = Handle<Array>::Cast(obj->Get(String::New("minor_hash_which")));
Handle <Array> hash3 = Handle<Array>::Cast(obj->Get(String::New("minor_hash")));
for (int i = 0; i < NUMBINS; i++){
//Handle<Array> a = Handle<Array>::Cast(hash2->Get(i));
Handle<Array> b = Handle<Array>::Cast(hash3->Get(i));
for (int j = 0; j < NUMMAX; j++){
h.hist_minor[i][j] = std::pair<HASH2INTTYPE, HASH2INTBOXES>();
//h.hist_minor[i][j].first = a->Get(j)->Uint32Value();
h.hist_minor[i][j].second = b->Get(j)->Uint32Value();
}
}
}
示例6: read_league_table_file
void league_table::read_league_table_file(Handle<Array> leagueDat)
{
// The file doesn't have to exist (if it doesn't, a new table is
// created). But if it exists, it must be in correct format
//
if (leagueDat->Length())
{
HandleScope scope;
Handle<Array> tokens;
for(int i=0, l=leagueDat->Length(); i<l; ++i)
{
tokens = Handle<Array>::Cast(leagueDat->Get(i));
// The structure of a line must be:
//
// PLACE TEAMNAME+ PL W D L GF GA GD PTS
//
// TEAMNAME may be multiple tokens, so we count from the
// end ! The first token is PLACE, the last 8 tokens are
// as specified, and everything between the first and
// the last 8 is the team name.
//
// Note: when the team name is restructured from the
// tokens, each token is separated by one space
//
unsigned num_tokens = tokens->Length();
if (num_tokens < 10)
die("The following line in leaguedat has too few tokens%s");
int points = tokens->Get(9)->IntegerValue();
int goal_difference = tokens->Get(8)->IntegerValue();
int goals_against = tokens->Get(7)->IntegerValue();
int goals_for = tokens->Get(6)->IntegerValue();
int lost = tokens->Get(5)->IntegerValue();
int drawn = tokens->Get(4)->IntegerValue();
int won = tokens->Get(3)->IntegerValue();
int played = tokens->Get(2)->IntegerValue();
char name[64];
toAscii(tokens->Get(1)->ToString(), name);
add_new_team(string(name), played, won, drawn, lost, goals_for, goals_against,
goal_difference, points);
}
}
}
示例7: UserGetElement
int ArrayConv::UserGetElement(JNIEnv *jniEnv, Handle<Object> val, unsigned int elementType, int idx, jobject *jVal) {
HandleScope scope;
TryCatch tryCatch;
Handle<Value> vElement = val->Get(idx);
if(vElement.IsEmpty()) return ErrorNotfound;
if(tryCatch.HasCaught()) return ErrorJS;
return conv->ToJavaObject(jniEnv, vElement, elementType, jVal);
}
示例8: key
static gboolean
gum_v8_flags_get (Handle<Object> flags,
const gchar * name,
GumV8Core * core)
{
Local<String> key (String::NewFromUtf8 (core->isolate, name));
return flags->Has (key) && flags->Get (key)->ToBoolean ()->BooleanValue ();
}
示例9: SCROpenWindow
Handle<Value> SCROpenWindow(const Arguments& args)
{
osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds);
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;
if(args.Length() > 1)
{
Handle<Object> traitsin = Handle<Object>::Cast(args[1]);
if(traitsin->Has(String::New("x"))) traits->x = traitsin->Get(String::New("x"))->Int32Value();
if(traitsin->Has(String::New("y"))) traits->y = traitsin->Get(String::New("y"))->Int32Value();
if(traitsin->Has(String::New("width"))) traits->width = traitsin->Get(String::New("width"))->Int32Value();
if(traitsin->Has(String::New("height"))) traits->height = traitsin->Get(String::New("height"))->Int32Value();
if(traitsin->Has(String::New("windowDecoration"))) traits->windowDecoration = traitsin->Get(String::New("windowDecoration"))->BooleanValue();
if(traitsin->Has(String::New("hostName"))) traits->hostName = ToStdString(traitsin->Get(String::New("hostName")));
if(traitsin->Has(String::New("displayNum"))) traits->displayNum = traitsin->Get(String::New("displayNum"))->Int32Value();
if(traitsin->Has(String::New("screenNum"))) traits->screenNum = traitsin->Get(String::New("screenNum"))->Int32Value();
if(traitsin->Has(String::New("vsync"))) traits->vsync = traitsin->Get(String::New("vsync"))->BooleanValue();
}
unsigned int contextid;
// TODO how to pass traits???
//dtEntityOSG::OSGWindowInterface* wface = static_cast<dtEntityOSG::OSGWindowInterface*>(dtEntity::GetWindowInterface());
//wface->SetTraits(traits);
bool success = dtEntity::GetWindowInterface()->OpenWindow(ToStdString(args[0]), contextid);
assert(success);
return Uint32::New(contextid);
}
示例10: ThrowError
Handle<Value> SCRSetWindowGeometry(const Arguments& args)
{
if(args.Length() != 2)
{
return ThrowError("Usage: setWindowGeometry(contextId, array[x,y,w,h])");
}
unsigned int contextId = args[0]->Uint32Value();
HandleScope scope;
Handle<Array> arr = Handle<Array>::Cast(args[1]);
int x = arr->Get(0)->Int32Value();
int y = arr->Get(1)->Int32Value();
int w = arr->Get(2)->Int32Value();
int h = arr->Get(3)->Int32Value();
dtEntity::GetWindowInterface()->SetWindowGeometry(contextId, x, y, w, h);
return Undefined();
}
示例11:
void V8Templates::fillFieldState(Handle<Object> v8Obj, FieldState *obj)
{
HandleScope scope;
_ASSERT(!v8Obj.IsEmpty());
v8Obj->SetInternalField(0, External::New(obj));
fillBorderState(Handle<Object>::Cast(v8Obj->Get(String::New("bordersRaw"))), obj->getBorders());
}
示例12: setKeysInOp
void setKeysInOp(Handle<Object> spec, Operation & op) {
HandleScope scope;
Local<Value> v;
Local<Object> o;
v = spec->Get(HELPER_KEY_BUFFER);
if(! v->IsNull()) {
o = v->ToObject();
op.key_buffer = V8BINDER_UNWRAP_BUFFER(o);
}
v = spec->Get(HELPER_KEY_RECORD);
if(! v->IsNull()) {
o = v->ToObject();
op.key_record = unwrapPointer<const Record *>(o);
}
}
示例13: createBlobWriteHandles
int KeyOperation::createBlobWriteHandles(Handle<Object> blobsArray,
const Record * rowRecord) {
DEBUG_MARKER(UDEB_DEBUG);
int ncreated = 0;
int ncol = rowRecord->getNoOfColumns();
for(int i = 0 ; i < ncol ; i++) {
if(blobsArray->Get(i)->IsObject()) {
Local<Object> blobValue = blobsArray->Get(i)->ToObject();
assert(node::Buffer::HasInstance(blobValue));
const NdbDictionary::Column * col = rowRecord->getColumn(i);
assert( (col->getType() == NdbDictionary::Column::Blob) ||
(col->getType() == NdbDictionary::Column::Text));
ncreated++;
setBlobHandler(new BlobWriteHandler(i, col->getColumnNo(), blobValue));
}
}
return ncreated;
}
示例14: UserGetLength
int ArrayConv::UserGetLength(JNIEnv *jniEnv, Handle<Object> val, int *length) {
HandleScope scope;
TryCatch tryCatch;
Handle<Value> vLength = val->Get(sLength);
if(vLength.IsEmpty()) return ErrorNotfound;
if(tryCatch.HasCaught()) return ErrorJS;
*length = (int)vLength->IntegerValue();
return OK;
}
示例15: initializeGlobalObject
void Processor::initializeGlobalObject(Handle<Object> g) {
g->Set(String::New("global"), g);
Handle<Object> paths = Array::New();
paths->Set(0, String::New("/usr/lib/purple/modules")); //TODO: move this to config
Handle<Object>::Cast(g->Get(String::New("require")))->Set(String::New("paths"), paths);
Handle<Object> env = Object::New();
env->Set(String::New("cwd"), String::New(getCwd().c_str()));
g->Set(String::New("_env"), env);
}