static NativeType getNativeSigned(v8::Local<v8::Value> js)
    {
        if (!js->IsNumber())
        {
            throw std::runtime_error("signed integer");
        }

        return static_cast<NativeType>(js->IntegerValue());
    }
Ejemplo n.º 2
0
CUInt128 CJSKadID::FromValue(v8::Local<v8::Value> value)
{
    v8::HandleScope HandleScope(v8::Isolate::GetCurrent());

	CUInt128 Value;
	if(value->IsString())
		Value.FromHex(CJSEngine::GetWStr(value));
	else if(value->IsObject())
	{
		if(CKadIDObj* pVariant = GetCObject<CKadIDObj>(value->ToObject()))
			Value = pVariant->m_Value;
		else if(CVariantPrx* pVariant = GetCObject<CVariantPrx>(value->ToObject()))
			Value = pVariant->GetCopy();
	}
	else	
	{
		sint64 iValue = value->IntegerValue();
		if(iValue < 0)
			Value = CUInt128(true);
		else
			Value = CUInt128((sint32)iValue);
	}
	return Value;
}