本文整理汇总了C++中Local::IsBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ Local::IsBoolean方法的具体用法?C++ Local::IsBoolean怎么用?C++ Local::IsBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Local
的用法示例。
在下文中一共展示了Local::IsBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
static gboolean
gum_v8_exception_handler_on_exception (GumExceptionDetails * details,
gpointer user_data)
{
GumV8ExceptionHandler * handler = (GumV8ExceptionHandler *) user_data;
GumV8Core * core = handler->core;
ScriptScope scope (core->script);
Isolate * isolate = core->isolate;
Local<Function> callback (Local<Function>::New (isolate, *handler->callback));
Local<Object> ex, context;
_gum_v8_parse_exception_details (details, ex, context, core);
Handle<Value> argv[] = { ex };
Local<Value> result = callback->Call (Null (isolate), 1, argv);
_gum_v8_cpu_context_free_later (
new GumPersistent<Object>::type (isolate, context),
core);
if (!result.IsEmpty () && result->IsBoolean ())
{
bool handled = result.As<Boolean> ()->Value ();
return handled ? TRUE : FALSE;
}
return FALSE;
}
示例2: callback
static gboolean
gum_v8_module_filter_matches (const GumModuleDetails * details,
GumV8ModuleFilter * self)
{
auto core = self->module->core;
auto isolate = core->isolate;
auto context = isolate->GetCurrentContext ();
auto module = _gum_v8_module_value_new (details, self->module);
auto callback (Local<Function>::New (isolate, *self->callback));
auto recv = Undefined (isolate);
Handle<Value> argv[] = { module };
Local<Value> result;
if (callback->Call (context, recv, G_N_ELEMENTS (argv), argv)
.ToLocal (&result))
{
return result->IsBoolean () && result.As<Boolean> ()->Value ();
}
else
{
core->current_scope->ProcessAnyPendingException ();
return FALSE;
}
}
示例3: 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);
}
示例4: ActiveSetter
void Toggle::ActiveSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<Toggle>(info.This())->_actor;
mx_toggle_set_active(MX_TOGGLE(instance), value->ToBoolean()->Value());
}
}
示例5: geomIgnoredSetter
void FeatureDefn::geomIgnoredSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
{
HandleScope scope;
FeatureDefn *def = ObjectWrap::Unwrap<FeatureDefn>(info.This());
if(!value->IsBoolean()){
NODE_THROW("geomIgnored must be a boolean");
return;
}
def->this_->SetGeometryIgnored(value->IntegerValue());
}
示例6: EnableAnimationsSetter
void BoxLayout::EnableAnimationsSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<BoxLayout>(info.This())->_actor;
mx_box_layout_set_enable_animations(MX_BOX_LAYOUT(instance), value->ToBoolean()->Value());
}
}
示例7: ignoredSetter
void FieldDefn::ignoredSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
{
HandleScope scope;
FieldDefn *def = ObjectWrap::Unwrap<FieldDefn>(info.This());
if(!value->IsBoolean()){
NODE_THROW("ignored must be a boolean");
return;
}
def->this_->SetIgnored(value->BooleanValue());
}
示例8: DisabledSetter
void Widget::DisabledSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<Actor>(info.This())->_actor;
mx_widget_set_disabled(MX_WIDGET(instance), value->ToBoolean()->Value());
}
}
示例9: ScrollToFocusedSetter
void BoxLayout::ScrollToFocusedSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<BoxLayout>(info.This())->_actor;
mx_box_layout_set_scroll_to_focused(MX_BOX_LAYOUT(instance), value->ToBoolean()->Value());
}
}
示例10: RepeatYSetter
void Texture::RepeatYSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<Actor>(info.This())->_actor;
g_object_set(G_OBJECT(instance), "repeat-y", value->ToBoolean()->Value(), NULL);
}
}
示例11: build_http_msg_buffer
void Msg_Struct::build_http_msg_buffer(Isolate* isolate, v8::Local<v8::Object> object, std::string &str) {
std::stringstream stream;
for(std::vector<Field_Info>::const_iterator iter = field_vec().begin();
iter != field_vec().end(); iter++) {
stream.str("");
stream << "\"" << iter->field_name << "\":";
Local<Value> value = object->Get(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, iter->field_name.c_str(), NewStringType::kNormal).ToLocalChecked()).ToLocalChecked();
if(iter->field_type == "int8" || iter->field_type == "int16" ||
iter->field_type == "int32") {
int32_t val = 0;
if (value->IsInt32()) {
val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
}
stream << val << ",";
}
else if(iter->field_type == "int64") {
int64_t val = 0;
if (value->IsNumber()) {
val = value->NumberValue(isolate->GetCurrentContext()).FromJust();
}
stream << val << ",";
}
else if(iter->field_type == "double") {
double val = 0;
if (value->IsNumber()) {
val = value->NumberValue(isolate->GetCurrentContext()).FromJust();
}
stream << val << ",";
}
else if(iter->field_type == "bool") {
bool val = 0;
if (value->IsBoolean()) {
val = value->BooleanValue(isolate->GetCurrentContext()).FromJust();
}
stream << val << ",";
}
else if(iter->field_type == "string") {
if (value->IsString()) {
String::Utf8Value str(value->ToString(isolate->GetCurrentContext()).ToLocalChecked());
stream << "\"" << ToCString(str) << "\",";
} else {
stream << "\"\",";
}
}
else {
LOG_ERROR("Can not find the field_type:%s, struct_name:%s", iter->field_type.c_str(), struct_name().c_str());
}
str += stream.str();
}
}
示例12: Set_FontState_strikeOut
static void Set_FontState_strikeOut(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
if (wrap.IsEmpty())
return;
FontState *tmp = (FontState *) wrap->Value();
if (tmp == NULL)
return;
if (!value.IsEmpty() && value->IsBoolean())
tmp->setStrikeOut(value->BooleanValue());
}
示例13: execute
bool JSWrapper::execute( const char *scr, JSWrapperData *data, const char *fileName )
{
HandleScope handle_scope( m_isolate );
Local<String> source = String::NewFromUtf8( m_isolate, scr, NewStringType::kNormal ).ToLocalChecked();
ScriptOrigin origin( v8::String::NewFromUtf8( m_isolate, fileName ? fileName : "Unknown" ) );
MaybeLocal<Script> maybeScript = Script::Compile( m_context, source, &origin );
bool success=false;
if ( !maybeScript.IsEmpty() )
{
Local<Script> script = maybeScript.ToLocalChecked();
MaybeLocal<Value> maybeResult = script->Run(m_context);
if ( !maybeResult.IsEmpty() )
{
Local<Value> result = maybeResult.ToLocalChecked();
if ( data )
{
if ( result->IsNumber() )
data->setNumber( result->ToNumber()->Value() );
else
if ( result->IsString() )
{
String::Utf8Value utf8( result );
data->setString( *utf8 );
} else
if ( result->IsBoolean() )
data->setBoolean( result->ToBoolean()->Value() );
else
if ( result->IsObject() )
data->setObject( new JSWrapperObject( m_isolate, result->ToObject() ) );
else
if ( result->IsNull() )
data->setNull();
else data->setUndefined();
}
success=true;
}
}
return success;
}
示例14: getGetdnsType
static GetdnsType getGetdnsType(Local<Value> value) {
if (value->IsNumber() || value->IsNumberObject()) {
return IntType;
} else if (value->IsBoolean() || value->IsBooleanObject()) {
return BoolType;
} else if (value->IsString() || value->IsStringObject()) {
return StringType;
} else if (value->IsObject()) {
// could be a node buffer or array
if (node::Buffer::HasInstance(value)) {
return BinDataType;
} else if (value->IsArray()) {
return ListType;
} else if (GNUtil::isDictionaryObject(value)) {
return DictType;
}
}
return UnknownType;
}
示例15: PolicyVerticalSetter
void ScrollView::PolicyVerticalSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
MxScrollPolicy policy;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<ScrollView>(info.This())->_actor;
policy = mx_scroll_view_get_scroll_policy(MX_SCROLL_VIEW(instance));
if (value->ToBoolean()->Value()) {
if (policy == MX_SCROLL_POLICY_HORIZONTAL)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_BOTH);
else if (policy == MX_SCROLL_POLICY_NONE)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_VERTICAL);
} else {
if (policy == MX_SCROLL_POLICY_VERTICAL)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_NONE);
else if (policy == MX_SCROLL_POLICY_BOTH)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_HORIZONTAL);
}
}
}