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


C++ Local::IsObject方法代码示例

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


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

示例1: prepare_import_results

void prepare_import_results(Local<Value> returned_value, sass_context_wrapper* ctx_w) {
  NanScope();

  if (returned_value->IsArray()) {
    Handle<Array> array = Handle<Array>::Cast(returned_value);

    ctx_w->imports = sass_make_import_list(array->Length());

    for (size_t i = 0; i < array->Length(); ++i) {
      Local<Value> value = array->Get(i);

      if (!value->IsObject())
        continue;

      Local<Object> object = Local<Object>::Cast(value);
      char* path = create_string(object->Get(NanNew<String>("file")));
      char* contents = create_string(object->Get(NanNew<String>("contents")));

      ctx_w->imports[i] = sass_make_import_entry(path, (!contents || contents[0] == '\0') ? 0 : strdup(contents), 0);
    }
  }
  else if (returned_value->IsObject()) {
    ctx_w->imports = sass_make_import_list(1);
    Local<Object> object = Local<Object>::Cast(returned_value);
    char* path = create_string(object->Get(NanNew<String>("file")));
    char* contents = create_string(object->Get(NanNew<String>("contents")));

    ctx_w->imports[0] = sass_make_import_entry(path, (!contents || contents[0] == '\0') ? 0 : strdup(contents), 0);
  }
  else {
    ctx_w->imports = sass_make_import_list(1);
    ctx_w->imports[0] = sass_make_import_entry(ctx_w->file, 0, 0);
  }
}
开发者ID:erikjwaxx,项目名称:node-sass,代码行数:34,代码来源:binding.cpp

示例2: createNextLevel

const NdbQueryOperationDef * createNextLevel(QueryOperation *queryOp,
                                             Handle<Object> spec,
                                             const NdbQueryOperationDef * parent) {
  DEBUG_MARKER(UDEB_DEBUG);
  NdbQueryBuilder *builder = queryOp->getBuilder();
  Isolate * isolate = Isolate::GetCurrent();

  /* Pull values out of the JavaScript object */
  Local<Value> v;
  const NdbDictionary::Table * table = 0;
  const NdbDictionary::Index * index = 0;
  int depth = spec->Get(GET_KEY(K_depth))->Int32Value();

  v = spec->Get(GET_KEY(K_tableHandler));
  if(v->IsObject()) {
    v = v->ToObject()->Get(GET_KEY(K_dbTable));
    if(v->IsObject()) {
      table = unwrapPointer<const NdbDictionary::Table *>(v->ToObject());
    }
  }
  bool isPrimaryKey = spec->Get(GET_KEY(K_isPrimaryKey))->BooleanValue();

  DEBUG_PRINT("Creating QueryOperationDef at level %d for table: %s",
              depth, table->getName());

  if(! isPrimaryKey) {
    v = spec->Get(GET_KEY(K_indexHandler));
    if(v->IsObject()) {
      v = v->ToObject()->Get(GET_KEY(K_dbIndex));
      if(v->IsObject()) {
        index = unwrapPointer<const NdbDictionary::Index *> (v->ToObject());
      }
    }
    assert(index);
  }

  v = spec->Get(GET_KEY(K_joinTo));
  Array * joinColumns = Array::Cast(*v);

  /* Build the key */
  int nKeyParts = joinColumns->Length();
  const NdbQueryOperand * key_parts[nKeyParts+1];

  for(int i = 0 ; i < nKeyParts ; i++) {
    String::Utf8Value column_name(joinColumns->Get(i));
    key_parts[i] = builder->linkedValue(parent, *column_name);
    DEBUG_PRINT_DETAIL("Key part %d: %s", i, *column_name);
  }
  key_parts[nKeyParts] = 0;

  return queryOp->defineOperation(index, table, key_parts);
}
开发者ID:plasmob,项目名称:mysql-js,代码行数:52,代码来源:QueryOperation_wrapper.cpp

示例3: createTopLevelQuery

const NdbQueryOperationDef * createTopLevelQuery(QueryOperation *queryOp,
                                                 Handle<Object> spec,
                                                 Handle<Object> keyBuffer) {
  DEBUG_MARKER(UDEB_DEBUG);
  Isolate * isolate = Isolate::GetCurrent();
  NdbQueryBuilder *builder = queryOp->getBuilder();

  /* Pull values out of the JavaScript object */
  Local<Value> v;
  const Record * keyRecord = 0;
  const NdbDictionary::Table * table = 0;
  const NdbDictionary::Index * index = 0;

  v = spec->Get(GET_KEY(K_keyRecord));
  if(v->IsObject()) {
    keyRecord = unwrapPointer<const Record *>(v->ToObject());
  };
  v = spec->Get(GET_KEY(K_tableHandler));
  if(v->IsObject()) {
    v = v->ToObject()->Get(GET_KEY(K_dbTable));
    if(v->IsObject()) {
      table = unwrapPointer<const NdbDictionary::Table *>(v->ToObject());
    }
  }
  bool isPrimaryKey = spec->Get(GET_KEY(K_isPrimaryKey))->BooleanValue();
  const char * key_buffer = node::Buffer::Data(keyBuffer);
  if(! isPrimaryKey) {
    v = spec->Get(GET_KEY(K_indexHandler));
    if(v->IsObject()) {
      v = v->ToObject()->Get(GET_KEY(K_dbIndex));
      if(v->IsObject()) {
        index = unwrapPointer<const NdbDictionary::Index *> (v->ToObject());
      }
    }
    assert(index);
  }

  /* Build the key */
  int nKeyParts = keyRecord->getNoOfColumns();
  const NdbQueryOperand * key_parts[nKeyParts+1];

  for(int i = 0; i < nKeyParts ; i++) {
    size_t offset = keyRecord->getColumnOffset(i);
    size_t length = keyRecord->getValueLength(i, key_buffer + offset);
    offset += keyRecord->getValueOffset(i);  // accounts for length bytes
    key_parts[i] = builder->constValue(key_buffer + offset, length);
  }
  key_parts[nKeyParts] = 0;

  return queryOp->defineOperation(index, table, key_parts);
}
开发者ID:plasmob,项目名称:mysql-js,代码行数:51,代码来源:QueryOperation_wrapper.cpp

示例4: jserror

jsvalue JsEngine::ErrorFromV8(TryCatch& trycatch)
{
    jsvalue v;

    HandleScope scope;
    
    Local<Value> exception = trycatch.Exception();
	    
	v.type = JSVALUE_TYPE_UNKNOWN_ERROR;
	v.value.str = 0;
    v.length = 0;

	// If this is a managed exception we need to place its ID inside the jsvalue
    // and set the type JSVALUE_TYPE_MANAGED_ERROR to make sure the CLR side will
    // throw on it.

    if (exception->IsObject()) {
        Local<Object> obj = Local<Object>::Cast(exception);
        if (obj->InternalFieldCount() == 1) {
			Local<External> wrap = Local<External>::Cast(obj->GetInternalField(0));
			ManagedRef* ref = (ManagedRef*)wrap->Value();
	        v.type = JSVALUE_TYPE_MANAGED_ERROR;
            v.length = ref->Id();
			return v;
		}
	}

	jserror *error = new jserror();
	memset(error, 0, sizeof(jserror));
	
	Local<Message> message = trycatch.Message();

	if (!message.IsEmpty()) {
		error->line = message->GetLineNumber();
		error->column = message->GetStartColumn();
		error->resource = AnyFromV8(message->GetScriptResourceName());
		error->message = AnyFromV8(message->Get());
	}
	 if (exception->IsObject()) {
        Local<Object> obj2 = Local<Object>::Cast(exception);
		error->type = AnyFromV8(obj2->GetConstructorName());
	 }

	error->exception = AnyFromV8(exception);
	v.type = JSVALUE_TYPE_ERROR;
	v.value.ptr = error;
    
	return v;
}
开发者ID:Daniel15,项目名称:vroomjs,代码行数:49,代码来源:jsengine.cpp

示例5:

void ParamRsaPSS::FromV8(Local<Value> v8Value) {
	try {
		Nan::HandleScope();

		if (!v8Value->IsObject()) {
			THROW_ERROR("Parameter 1 MUST be Object", NULL);
		}

		Local<Object> v8Params = v8Value->ToObject();

		// Check data
		if (!check_param_number(v8Params, STR_MGF))
			THROW_ERROR("Attribute 'mgf' MUST be NUMBER", NULL);
		if (!check_param_number(v8Params, STR_SALT_LEN))
			THROW_ERROR("Attribute 'saltLen' MUST be NUMBER", NULL);
		if (!check_param_number(v8Params, STR_HASH_ALG))
			THROW_ERROR("Attribute 'hashAlg' MUST be NUMBER", NULL);

		Free();
		Init();

		param.sLen = Nan::To<v8::Number>(v8Params->Get(Nan::New(STR_SALT_LEN).ToLocalChecked())).ToLocalChecked()->Uint32Value();
		param.mgf = Nan::To<v8::Number>(v8Params->Get(Nan::New(STR_MGF).ToLocalChecked())).ToLocalChecked()->Uint32Value();
		param.hashAlg = Nan::To<v8::Number>(v8Params->Get(Nan::New(STR_HASH_ALG).ToLocalChecked())).ToLocalChecked()->Uint32Value();

	}
	CATCH_ERROR;
}
开发者ID:PeculiarVentures,项目名称:pkcs11js,代码行数:28,代码来源:param_rsa.cpp

示例6: TryConvertToJavaLong

bool ArgConverter::TryConvertToJavaLong(const Local<Value>& value, jlong& javaLong)
{
	bool success = false;

	if (!value.IsEmpty())
	{
		if (value->IsNumber() || value->IsNumberObject())
		{
			javaLong = (jlong)value->IntegerValue();
			success = true;
		}
		else if (value->IsObject())
		{
			auto obj = Local<Object>::Cast(value);
			auto isJavaLongValue = obj->GetHiddenValue(V8StringConstants::GetJavaLong());
			if (!isJavaLongValue.IsEmpty() && isJavaLongValue->BooleanValue())
			{
				javaLong = (jlong)ConvertToJavaLong(value);
				success = true;
			}
		}
	}

	return success;
}
开发者ID:slavchev,项目名称:android-runtime,代码行数:25,代码来源:ArgConverter.cpp

示例7: if

void
encodeArray(bson_buffer *bb, const char *name, const Local<Value> element) {
    Local<Array> a = Array::Cast(*element);
    bson_buffer *arr = bson_append_start_array(bb, name);

    for (int i = 0, l=a->Length(); i < l; i++) {
        Local<Value> val = a->Get(Number::New(i));
        stringstream keybuf;
        string keyval;
        keybuf << i << endl;
        keybuf >> keyval;

        if (val->IsString()) {
            encodeString(arr, keyval.c_str(), val);
        }
        else if (val->IsInt32()) {
            encodeInteger(arr, keyval.c_str(), val);
        }
        else if (val->IsNumber()) {
            encodeNumber(arr, keyval.c_str(), val);
        }
        else if (val->IsBoolean()) {
            encodeBoolean(arr, keyval.c_str(), val);
        }
        else if (val->IsArray()) {
            encodeArray(arr, keyval.c_str(), val);
        }
        else if (val->IsObject()) {
            bson bson(encodeObject(val));
            bson_append_bson(arr, keyval.c_str(), &bson);
            bson_destroy(&bson);
        }
    }
    bson_append_finish_object(arr);
}
开发者ID:w1nk,项目名称:node-mongodb,代码行数:35,代码来源:bson.cpp

示例8: ValidateOptions

bool ValidateOptions(Local<Value> options, Isolate *isolate) {
  if (!options->IsObject()) {
    isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Options must be an object")));
    return false;
  }
  return true;
}
开发者ID:nevermnd,项目名称:anitomy-js,代码行数:7,代码来源:addon.cpp

示例9:

	txn_scope(Local<Value> arg, MDB_env *env) : _env(NULL), _txn(NULL), _readonly(false), _created(false), _commit(false) {
		if (arg->IsObject()) {
			_txn = node::ObjectWrap::Unwrap<txn>(arg->ToObject())->_txn;
		} else {
			_created = true;
			mdb_txn_begin(env, NULL, 0, &_txn);
		}
	}
开发者ID:talrasha007,项目名称:node-kv,代码行数:8,代码来源:db-lmdb.cpp

示例10: NanEscapeScope

Handle<Value> TypedArray::New(GDALDataType type, unsigned int length)  {
	NanEscapableScope();

	Handle<Value> val;
	Handle<Function> constructor;
	Local<Object> global = NanGetCurrentContext()->Global();

	const char *name;
	switch(type) {
		case GDT_Byte:    name = "Uint8Array";   break;
		case GDT_Int16:   name = "Int16Array";   break;
		case GDT_UInt16:  name = "Uint16Array";  break;
		case GDT_Int32:   name = "Int32Array";   break;
		case GDT_UInt32:  name = "Uint32Array";  break;
		case GDT_Float32: name = "Float32Array"; break;
		case GDT_Float64: name = "Float64Array"; break;
		default: 
			NanThrowError("Unsupported array type"); 
			return NanEscapeScope(NanUndefined());
	}


	// make ArrayBuffer
	val = global->Get(NanNew("ArrayBuffer"));

	if(val.IsEmpty() || !val->IsFunction()) {
		NanThrowError("Error getting ArrayBuffer constructor");
		return NanEscapeScope(NanUndefined());
	}

	constructor = val.As<Function>();
	Local<Value> size = NanNew<Integer>(length * GDALGetDataTypeSize(type) / 8);
	Local<Value> array_buffer = constructor->NewInstance(1, &size);

	if(array_buffer.IsEmpty() || !array_buffer->IsObject()) {
		NanThrowError("Error allocating ArrayBuffer");
		return NanEscapeScope(NanUndefined());
	}


	// make TypedArray
	val = global->Get(NanNew(name));

	if(val.IsEmpty() || !val->IsFunction()) {
		NanThrowError("Error getting typed array constructor");
		return NanEscapeScope(NanUndefined());
	}

	constructor = val.As<Function>();
	Local<Object> array = constructor->NewInstance(1, &array_buffer);

	if(array.IsEmpty() || !array->IsObject()) {
		NanThrowError("Error creating TypedArray");
		return NanEscapeScope(NanUndefined());
	}

	return NanEscapeScope(array);
}
开发者ID:mojodna,项目名称:node-gdal,代码行数:58,代码来源:typed_array.cpp

示例11: object

 void V8BuilderPolicy::SetDictKeyValue(std::string const & key,
     type const & var)
 {
   Nan::HandleScope scope;
   Local<Value> object(Nan::New(object_));
   assert(object->IsObject());
   Local<Object> obj = Local<Object>::Cast(object);
   assert(obj->IsObject());
   obj->Set(Nan::New(key).ToLocalChecked(), Nan::New(var));
 }
开发者ID:eye3,项目名称:nkit4nodejs,代码行数:10,代码来源:v8_var_policy.cpp

示例12: liveStreaming

TaskOptions::TaskOptions(Handle<Object> source) :
    liveStreaming(NULL) {
  HandleScope scope;

  Local<Object> liveStreaming =
      Local<Object>::Cast(source->Get(String::New("liveStreaming")));
  if (!liveStreaming.IsEmpty() && liveStreaming->IsObject()) {
    this->liveStreaming = new LiveStreamingOptions(liveStreaming);
  }
}
开发者ID:benvanik,项目名称:node-transcoding,代码行数:10,代码来源:taskoptions.cpp

示例13: isGlobalAgent

// Check if this appmetrics agent native module is loaded via the node-hc command.
// This is actually checking if this module has appmetrics/launcher.js as it's grandparent.
// For reference:
// A locally loaded module would have ancestry like:
//   ...
//   ^-- some_module_that_does_require('appmetrics') (grandparent)
//       ^--- .../node_modules/appmetrics/index.js (parent)
//            ^-- .../node_modules/appmetrics/appmetrics.node (this)
//
// A globally loaded module would have ancestry like:
//   .../node_modules/appmetrics/launcher.js (grandparent)
//   ^--- .../node_modules/appmetrics/index.js (parent)
//        ^-- .../node_modules/appmetrics/appmetrics.node (this)
//
static bool isGlobalAgent(Handle<Object> module) {
	Nan::HandleScope scope;
	Local<Value> parent = module->Get(Nan::New<String>("parent").ToLocalChecked());
	if (parent->IsObject()) {
		Local<Value> filename = parent->ToObject()->Get(Nan::New<String>("filename").ToLocalChecked());
		if (filename->IsString() && isAppMetricsFile("index.js", toStdString(filename->ToString()))) {
			Local<Value> grandparent = parent->ToObject()->Get(Nan::New<String>("parent").ToLocalChecked());
			Local<Value> gpfilename = grandparent->ToObject()->Get(Nan::New<String>("filename").ToLocalChecked());
			if (gpfilename->IsString() && isAppMetricsFile("launcher.js", toStdString(gpfilename->ToString()))) {
				return true;
			}
		}
	}
	return false;
}
开发者ID:apg84,项目名称:appmetrics,代码行数:29,代码来源:appmetrics.cpp

示例14: 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) {
        op.nblobs = op.createBlobReadHandles(record);
      } else {
        op.nblobs = op.createBlobWriteHandles(v->ToObject(), record);
      }
    }
  }
  
  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 %s -- mask: %u lobs: %d", op.getOperationName(), 
              op.u.maskvalue, op.nblobs);
}
开发者ID:WhiteWaterCoder,项目名称:mysql-js,代码行数:48,代码来源:DBOperationHelper.cpp

示例15: createStringMethods

void TiRootObject::createStringMethods()
{
    Local<Value> str = context_->Global()->Get(String::New("String"));
    if (!str->IsObject())
    {
        // This should never happen
        ThrowException(String::New(Ti::Msg::INTERNAL__Global_String_symbol_is_not_an_object));
    }
    Local<Object> strObj = str->ToObject();
    const NativeStringInterface* nsi = objectFactory_->getNativeStringInterface();
    strObj->Set(String::New("format"), FunctionTemplate::New(nsi->format)->GetFunction());
    strObj->Set(String::New("formatCurrency"), FunctionTemplate::New(nsi->formatCurrency)->GetFunction());
    strObj->Set(String::New("formatDate"), FunctionTemplate::New(nsi->formatDate)->GetFunction());
    strObj->Set(String::New("formatDecimal"), FunctionTemplate::New(nsi->formatDecimal)->GetFunction());
    strObj->Set(String::New("formatTime"), FunctionTemplate::New(nsi->formatTime)->GetFunction());
}
开发者ID:sanyaade-mobiledev,项目名称:TideSDK-Blackberry,代码行数:16,代码来源:TiRootObject.cpp


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