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


C++ Handle::IsNull方法代码示例

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


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

示例1: set

void ColumnProxy::set(Handle<Value> newValue) {
  Dispose();
  isNull = (newValue->IsNull());
  isLoaded = isDirty = true;
  jsValue = Persistent<Value>::New(newValue);
  DEBUG_PRINT("set %s", handler->column->getName());
}
开发者ID:kevinsawicki,项目名称:mysql-js,代码行数:7,代码来源:ColumnProxy.cpp

示例2: UserException

    int V8Scope::type( const char *field ){
        V8_SIMPLE_HEADER
        Handle<Value> v = get( field );
        if ( v->IsNull() )
            return jstNULL;
        if ( v->IsUndefined() )
            return Undefined;
        if ( v->IsString() )
            return String;
        if ( v->IsFunction() )
            return Code;
        if ( v->IsArray() )
            return Array;
        if ( v->IsBoolean() )
            return Bool;
        if ( v->IsInt32() )
            return NumberInt;
        if ( v->IsNumber() )
            return NumberDouble;
        if ( v->IsExternal() ){
            uassert( 10230 ,  "can't handle external yet" , 0 );
            return -1;
        }
        if ( v->IsDate() )
            return Date;
        if ( v->IsObject() )
            return Object;

        throw UserException( 12509, (string)"don't know what this is: " + field );
    }
开发者ID:IlyaM,项目名称:mongo,代码行数:30,代码来源:engine_v8.cpp

示例3: ToJavaMap

int Conv::ToJavaMap(JNIEnv *jniEnv, Handle<Value> val, int componentType, jobject *jVal) {
  Local<Object> oVal;
  Local<Array> aPropertyNames;
  if(val.IsEmpty() || val->IsNull() || val->IsUndefined()) {
    *jVal = 0;
    return OK;
  }
  if(!val->IsObject())
    return ErrorType;
  
  oVal = val->ToObject();
  aPropertyNames = oVal->GetOwnPropertyNames();
  int len = aPropertyNames->Length();

  jobject ob = jniEnv->NewObject(mapClass, mapCtor);
  if(ob) {
    int res = OK;
    for(int i = 0; i < len; i++) {
      Local<String> key = Local<String>::Cast(aPropertyNames->Get(i));
      jstring jKey; jobject item;
      res = ToJavaString(jniEnv, key, &jKey);
      if(res != OK) break;
      res = ToJavaObject(jniEnv, oVal->Get(key), componentType, &item);
      if(res != OK) break;
      jniEnv->CallObjectMethod(ob, mapPut, jKey, item);
    }
  }
  if(ob) {
    *jVal = ob;
    return OK;
  }
  if(jniEnv->ExceptionCheck())
    jniEnv->ExceptionClear();
  return ErrorVM;
}
开发者ID:Armen138,项目名称:anode,代码行数:35,代码来源:Conv.cpp

示例4: jniScope

JNIEXPORT void JNICALL
Java_org_appcelerator_kroll_runtime_v8_V8Object_nativeSetWindow
	(JNIEnv *env, jobject javaKrollWindow, jlong ptr, jobject javaWindow)
{
	ENTER_V8(V8Runtime::globalContext);
	titanium::JNIScope jniScope(env);

	Handle<Object> jsKrollWindow;
	if (ptr != 0) {
		jsKrollWindow = Persistent<Object>((Object *) ptr);
	} else {
		jsKrollWindow = TypeConverter::javaObjectToJsValue(env, javaKrollWindow)->ToObject();
	}

	Handle<Value> setWindowValue = jsKrollWindow->Get(String::New("setWindow"));
	if (!setWindowValue->IsFunction()) {
		return;
	}

	Handle<Function> setWindow = Handle<Function>::Cast(setWindowValue->ToObject());

	Handle<Value> jsWindow = TypeConverter::javaObjectToJsValue(env, javaWindow);

	TryCatch tryCatch;
	if (!jsWindow->IsNull()) {
		Handle<Value> args[] = { jsWindow };
		setWindow->Call(jsKrollWindow, 1, args);
	}

	if (tryCatch.HasCaught()) {
		V8Util::openJSErrorDialog(tryCatch);
		V8Util::reportException(tryCatch);
	}
}
开发者ID:mohdaminyuddin,项目名称:titanium_mobile,代码行数:34,代码来源:V8Object.cpp

示例5: printV8Value

void printV8Value(Handle<Value> value, bool force=false)
{
    Logging::Level level = force ? Logging::ERROR : Logging::INFO;

    if (!Logging::shouldShow(level)) return;

    HandleScope handleScope;

    if (value.IsEmpty())
        Logging::log(level, "Empty handle\r\n");
    else if (value->IsInt32())
        Logging::log(level, "INT: %d\r\n", value->IntegerValue());
    else if (value->IsNull())
        Logging::log(level, "NULL (null)\r\n");
    else if (value->IsUndefined())
        Logging::log(level, "VOID (undefined)\r\n");
    else if (value->IsBoolean())
        Logging::log(level, "BOOLEAN: %d\r\n", value->BooleanValue());
    else if (value->IsNumber())
        Logging::log(level, "NUMBER: %f\r\n", value->NumberValue());
    else if (value->IsString())
        Logging::log(level, "STRING: ?\r\n");
    else if (value->IsObject())
        Logging::log(level, "OBJECT (object)\r\n");
    else
        Logging::log(level, "Uncertain V8 value\n");
}
开发者ID:Amplifying,项目名称:intensityengine,代码行数:27,代码来源:script_engine_v8.cpp

示例6: BSONObj

 BSONObj V8Scope::getObject( const char * field ){
     Handle<Value> v = get( field );
     if ( v->IsNull() || v->IsUndefined() )
         return BSONObj();
     uassert( "not an object" , v->IsObject() );
     return v8ToMongo( v->ToObject() );
 }
开发者ID:lizalbin,项目名称:mongo,代码行数:7,代码来源:engine_v8.cpp

示例7: ParsePart

	Handle<Object> ParsePart(const google::protobuf::Message &message) {
		HandleScope scope;
		const Reflection* r = message.GetReflection();
		const Descriptor* descriptor = message.GetDescriptor();

		Local<Array> properties = Array::New(descriptor->field_count());
		for (int i = 0; i < descriptor->field_count(); i++) {
			const FieldDescriptor* field = descriptor->field(i);
			bool repeated = field->is_repeated();
			if (repeated && !r->FieldSize(message, field)) continue;
			if (!repeated && !r->HasField(message, field)) continue;

			Handle<Value> value;
			if (field->is_repeated()) {
				int size = r->FieldSize(message, field);
				Handle<Array> array = Array::New(size);
				for (int j = 0; j < size; j++)
					array->Set(j, ParseField(message, r, field, j));
				value = array;
			} else {
				value = ParseField(message, r, field, -1);
			}

			if (value->IsNull()) continue;

			properties->Set(i, value);
		}

		Local<Function> from_array = handle_->GetInternalField(2).As<Function>();

		Handle<Value> args = properties;
		return scope.Close(from_array->NewInstance(1, &args));
	}
开发者ID:ftcaicai,项目名称:GOD,代码行数:33,代码来源:protobuf.cpp

示例8: setPersistentFunc

	void setPersistentFunc(Persistent<Function>& pf,Handle<Value>& v){
		if(v->IsFunction()){
			if(!pf.IsEmpty()) pf.Dispose();
			pf = Persistent<Function>::New(Handle<Function>::Cast(v));
		}else if(v->IsNull()||v->IsUndefined()){
			if(pf.IsEmpty()) return;
			pf.Dispose();
			pf.Clear();
		}
	}
开发者ID:pgmsoul,项目名称:GitLib,代码行数:10,代码来源:v8base.cpp

示例9: GetNaturalType

int Conv::GetNaturalType(Handle<Value> val) {
  if(val.IsEmpty()) return TYPE_INVALID;
  if(val->IsUndefined()) return TYPE_UNDEFINED;
  if(val->IsNull()) return TYPE_NULL;
  if(val->IsBoolean() || val->IsBooleanObject()) return TYPE_BOOL;
  if(val->IsInt32()) return TYPE_INT;
  if(val->IsUint32()) return TYPE_LONG;
  if(val->IsNumber() || val->IsNumberObject()) return TYPE_DOUBLE;
  if(val->IsString() || val->IsStringObject()) return TYPE_STRING;
  return GetNaturalType(Handle<Object>::Cast(val));
}
开发者ID:Armen138,项目名称:anode,代码行数:11,代码来源:Conv.cpp

示例10: set

void ColumnProxy::set(Handle<Value> newValue) {
  HandleScope scope;
    
  /* Drop our claim on the old value */
  if(! jsValue.IsEmpty()) jsValue.Dispose();
  
  isNull = (newValue->IsNull());
  isLoaded = isDirty = true;
  jsValue = Persistent<Value>::New(newValue);
  DEBUG_PRINT("set %s", handler->column->getName());
}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:11,代码来源:ColumnProxy.cpp

示例11: setField

inline bool setField(OGRFeature* f, int field_index, Handle<Value> val){
	if (val->IsInt32()) {
		f->SetField(field_index, val->Int32Value());
	} else if (val->IsNumber()) {
		f->SetField(field_index, val->NumberValue());
	} else if (val->IsString()) {
		std::string str = *NanUtf8String(val);
		f->SetField(field_index, str.c_str());
	} else if(val->IsNull() || val->IsUndefined()) {
		f->UnsetField(field_index);
	} else {
		return true;
	}
	return false;
}
开发者ID:drownedout,项目名称:datamap,代码行数:15,代码来源:feature_fields.cpp

示例12: jniScope

JNIEXPORT jboolean JNICALL
Java_org_appcelerator_kroll_runtime_v8_V8Object_nativeFireEvent
	(JNIEnv *env, jobject jEmitter, jlong ptr, jstring event, jobject data)
{
	ENTER_V8(V8Runtime::globalContext);
	JNIScope jniScope(env);

	Handle<Value> jsEvent = TypeConverter::javaStringToJsString(event);

#ifdef TI_DEBUG
	String::Utf8Value eventName(jsEvent);
	LOGV(TAG, "firing event \"%s\"", *eventName);
#endif

	Handle<Object> emitter;
	if (ptr != 0) {
		emitter = Persistent<Object>((Object *) ptr);
	} else {
		emitter = TypeConverter::javaObjectToJsValue(jEmitter)->ToObject();
	}

	Handle<Value> fireEventValue = emitter->Get(EventEmitter::emitSymbol);
	if (!fireEventValue->IsFunction()) {
		return JNI_FALSE;
	}

	Handle<Function> fireEvent = Handle<Function>::Cast(fireEventValue->ToObject());

	Handle<Value> jsData = TypeConverter::javaObjectToJsValue(data);
	Handle<Value> result;

	TryCatch tryCatch;
	if (jsData->IsNull()) {
		Handle<Value> args[] = { jsEvent };
		result = fireEvent->Call(emitter, 1, args);
	} else {
		Handle<Value> args[] = { jsEvent, jsData };
		result = fireEvent->Call(emitter, 2, args);
	}

	if (tryCatch.HasCaught()) {
		V8Util::openJSErrorDialog(tryCatch);
		V8Util::reportException(tryCatch);
	} else if (result->IsTrue()) {
		return JNI_TRUE;
	}
	return JNI_FALSE;
}
开发者ID:AppceleratorCasts,项目名称:titanium_mobile,代码行数:48,代码来源:V8Object.cpp

示例13: assert

void
Session::formOptions(std::string* str, Handle<Value> value)
{
    // Use the HandleScope of the calling function for speed.

    if (value->IsUndefined() || value->IsNull())
        return;

    assert(value->IsObject());

    std::stringstream ss;

    if (value->IsArray()) {
        // Format each array value into the options string "V[&V]"
        Local<Object> object = value->ToObject();
        for (std::size_t i = 0; i < Array::Cast(*object)->Length(); ++i) {
            Local<String> key = object->Get(i)->ToString();
            String::Utf8Value valv(key);
            if (valv.length()) {
                if (i > 0)
                    ss << "&";
                ss << *valv;
            }
        }
    } else {
        // Format each KV pair into the options string "K=V[&K=V]"
        Local<Object> object = value->ToObject();
        Local<Array> keys = object->GetPropertyNames();
        for (std::size_t i = 0; i < keys->Length(); ++i) {
            Local<String> key = keys->Get(i)->ToString();
            String::Utf8Value keyv(key);
            if (keyv.length()) {
                if (i > 0)
                    ss << "&";
                ss << *keyv << "=";
            }

            Local<String> val = object->Get(key)->ToString();
            String::Utf8Value valv(val);
            if (valv.length())
                ss << *valv;
        }
    }

    *str = ss.str();
}
开发者ID:ZJONSSON,项目名称:node-blpapi,代码行数:46,代码来源:blpapijs.cpp

示例14:

Handle<Value> GeoJSONReader::getCoordsArray(Handle<Object> geojson) {
    Isolate* isolate = Isolate::GetCurrent();

    Handle<String> coordsKey = String::NewFromUtf8(isolate, "coordinates");
    if (!geojson->HasOwnProperty(coordsKey))
        throw "Property \"coordinates\" is missing";


    Handle<Value> coords = geojson->Get(coordsKey);
    if (
        !coords->IsArray()
        && !coords->IsNull()
        && !coords->IsUndefined()
    )
        throw "Property \"coordinates\" must be an instance of Array or null";


    return coords;
}
开发者ID:kashif,项目名称:node-geos,代码行数:19,代码来源:geojsonreader.cpp

示例15: valueToDouble

geos::geom::Coordinate GeoJSONReader::getCoordinate(Handle<Value> value, bool acceptArrayOnly) {

    bool isArray = value->IsArray();

    if (acceptArrayOnly) {
        if (!isArray)
            throw "A coordinate must be an instance of Array";


    }
    else {
        if (
            !isArray
            && !value->IsNull()
            && !value->IsUndefined()
        )
            throw "A coordinate must be an instance of Array or null";


        if (!isArray)
            return geos::geom::Coordinate::getNull();
    }


    Handle<Array> array = Handle<Array>::Cast(value);
    uint32_t length = array->Length();
    if (length < 2)
        throw "A coordinate's length must be >= 2";


    geos::geom::Coordinate coord;

    coord.x = valueToDouble(array->Get(0));
    coord.y = valueToDouble(array->Get(1));
    if (length > 2) {
        coord.z = valueToDouble(array->Get(2));
    }
    precisionModel->makePrecise(&coord);

    return coord;
}
开发者ID:kashif,项目名称:node-geos,代码行数:41,代码来源:geojsonreader.cpp


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