本文整理汇总了C++中Local::Int32Value方法的典型用法代码示例。如果您正苦于以下问题:C++ Local::Int32Value方法的具体用法?C++ Local::Int32Value怎么用?C++ Local::Int32Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Local
的用法示例。
在下文中一共展示了Local::Int32Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PropertySetter
void MSMap::PropertySetter (Local<String> property, Local<Value> value, const AccessorInfo& info) {
MSMap *map = ObjectWrap::Unwrap<MSMap>(info.Holder());
v8::String::AsciiValue n(property);
if (strcmp(*n, "width") == 0) {
map->this_->width = value->Int32Value();
} else if (strcmp(*n, "height") == 0) {
map->this_->height = value->Int32Value();
} else if (strcmp(*n, "maxsize") == 0) {
map->this_->maxsize = value->Int32Value();
} else if (strcmp(*n, "units") == 0) {
int32_t units = value->Int32Value();
if (units >= MS_INCHES && units <= MS_NAUTICALMILES) {
map->this_->units = (MS_UNITS) units;
}
} else if (strcmp(*n, "resolution") == 0) {
map->this_->resolution = value->NumberValue();
} else if (strcmp(*n, "defresolution") == 0) {
map->this_->defresolution = value->NumberValue();
} else if (strcmp(*n, "name") == 0) {
REPLACE_STRING(map->this_->name, value);
} else if (strcmp(*n, "imagetype") == 0) {
REPLACE_STRING(map->this_->imagetype, value);
} else if (strcmp(*n, "shapepath") == 0) {
REPLACE_STRING(map->this_->shapepath, value);
} else if (strcmp(*n, "projection") == 0) {
v8::String::AsciiValue _v_(value->ToString());
msLoadProjectionString(&(map->this_->projection), *_v_);
} else if (strcmp(*n, "mappath") == 0) {
REPLACE_STRING(map->this_->mappath, value);
}
}
示例2: setHeight
void setHeight(Local<String> property, Local<Value> value,
const AccessorInfo& info) {
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
void* ptr = wrap->Value();
#ifdef DEBUG
LOGI("Setting height to %d", value->Int32Value());
#endif
static_cast<BGJSView*>(ptr)->height = value->Int32Value();
}
示例3: PointJsToC
bool PointJsToC(v8::Handle<Value> value,cs::Twin* r){
HandleScope store;
if(!value->IsObject()) return false;
Local<Object> vObj = value->ToObject();
Local<Value> vx = vObj->Get(String::New("x"));
if(vx->IsUndefined()) return false;
Local<Value> vy = vObj->Get(String::New("y"));
if(vy->IsUndefined()) return false;
r->x = vx->Int32Value();
r->y = vy->Int32Value();
return true;
}
示例4: 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);
}
示例5: Base_SetA
void Base_SetA(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
Base* ptr = GetObjectPtr(info.This());
assert(ptr);
ptr->a = value->Int32Value();
}
示例6: wWinMain
int __stdcall wWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow){
int rt = -1;
initContext();
HandleScope store;
runJSRes(IDR_JS_STRUCT,L"app.lib");
Handle<Value> result = runJSFile(L"main.js",L"utf-8");
if(!result.IsEmpty()){//只有出错的时候才会返回Empty, 否则即使没有返回值, result仍然是Undefined.
Local<Object> gObj = getGlobal();
Local<Function> main = GetJSVariant<Function>(gObj,L"main");
if(main.IsEmpty()){
//InnerMsg(L"没有发现 main 函数",MT_ERROR);
}else if(!main->IsFunction()){
//InnerMsg(L"main 不是函数",MT_ERROR);
}else{
TryCatch err;
Handle<Value> args[1];
args[0] = String::New((uint16_t*)lpCmdLine);
Local<Value> r = main->Call(gObj,1,args);
if(!err.Exception().IsEmpty()){
ReportError(err);
}else
rt = r->Int32Value();
}
}
releaseContext();
return rt;
}
示例7: v8test_eval
bool v8test_eval()
{
BEGINTEST();
HandleScope handle_scope;
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
Local<Object> qmlglobal = Object::New();
qmlglobal->Set(String::New("a"), Integer::New(1922));
Local<Script> script = Script::Compile(String::New("eval(\"a\")"), NULL, NULL,
Handle<String>(), Script::QmlMode);
TryCatch tc;
Local<Value> result = script->Run(qmlglobal);
VERIFY(!tc.HasCaught());
VERIFY(result->Int32Value() == 1922);
cleanup:
context.Dispose();
ENDTEST();
}
示例8: SetTop
void UiWindow::SetTop(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& info) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
UiWindow* _this = Unwrap<UiWindow>(info.This());
WindowRect rect = _this->GetWindowRect();
rect.Top = value->Int32Value();
_this->SetWindowRect(rect);
}
示例9: RectJsToC
//.........这里部分代码省略.........
// ],
// "return":{
// "type":"void",
// "text":"函数没有返回值。"
// }
// },
// {
// "type":"function",
// "name":"setSize",
// "text":"设置矩形的大小,这个函数通过调整 right 和 bottom 来调整矩形的大小。",
// "param":[
// {
// "type":"integer",
// "name":"[width]",
// "text":"矩形新的宽度,如果此值为 undefined,矩形的宽度不变。"
// },
// {
// "type":"integer",
// "name":"[height]",
// "text":"矩形新的高度,如果此值为 undefined,矩形的高度不变。"
// }
// ],
// "return":{
// "type":"void",
// "text":"这个函数没有返回值。"
// }
// },
// {
// "type":"function",
// "name":"getSize",
// "text":"获取矩形的大小。",
// "param":[
// ],
// "return":{
// "type":"Size",
// "text":"返回一个 Size 对象。"
// }
// },
// {
// "type":"function",
// "name":"positive",
// "text":"通过交换 left 和 right 或者 top 和 bottom 的值来保证,left 总是小于等于 right,top 总是小于等于 bottom。",
// "param":[
// ],
// "return":{
// "type":"void",
// "text":"这个函数没有返回值。"
// }
// },
// {
// "type":"function",
// "name":"setValue(left,top,right,bottom)",
// "text":"设置矩形的 4 个属性,这个函数直接设置,不做任何检测。",
// "param":[
// {
// "type":"integer",
// "name":"left",
// "text":"要设置的 left 属性值。"
// },
// {
// "type":"integer",
// "name":"top",
// "text":"要设置的 top 属性值。"
// },
// {
// "type":"integer",
// "name":"right",
// "text":"要设置的 right 属性值。"
// },
// {
// "type":"integer",
// "name":"bottom",
// "text":"要设置的 bottom 属性值。"
// }
// ],
// "return":{
// "type":"void",
// "text":"这个函数没有返回值。"
// }
// }
// ]
//}//*
bool RectJsToC(v8::Handle<Value> value,cs::Rect* r){
HandleScope store;
if(!value->IsObject()) return false;
Local<Object> vObj = value->ToObject();
Local<Value> vl = vObj->Get(String::New("left"));
if(vl->IsUndefined()) return false;
Local<Value> vt = vObj->Get(String::New("top"));
if(vt->IsUndefined()) return false;
Local<Value> vr = vObj->Get(String::New("right"));
if(vr->IsUndefined()) return false;
Local<Value> vb = vObj->Get(String::New("bottom"));
if(vb->IsUndefined()) return false;
r->left = vl->Int32Value();
r->top = vt->Int32Value();
r->right = vr->Int32Value();
r->bottom = vb->Int32Value();
return true;
}
示例10: JSResult
long NativeWindow::JSResult(){
Local<Value> result = v8handle_->Get(String::NewSymbol("result"));
if (result->IsUndefined() || result->IsNull()) {
return 0;
} else {
v8handle_->Set(String::NewSymbol("result"), Undefined());
return result->Int32Value();
}
}
示例11: SetPointY
void SetPointY(Local<String> property,
Local<Value> value,
const PropertyCallbackInfo<Value>& info)
{
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
void* ptr = wrap->Value();
static_cast<Point*>(ptr)->y_ = value->Int32Value();
}
示例12: jsMyClassSetNumber
void jsMyClassSetNumber(
Local<String> property,
Local<Value> value,
const PropertyCallbackInfo<void>& info)
{
Local<Object> self = info.Holder();
ObjectWrap* pMyClass = ObjectWrap::Unwrap<ObjectWrap>(self);
static_cast<MyClass*>(pMyClass)->setNumber(value->Int32Value());
}
示例13: SetState
void UiWindow::SetState(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& info) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
UiWindow* _this = Unwrap<UiWindow>(info.This());
if (value->IsNumber()) {
WINDOW_STATE state = (WINDOW_STATE)value->Int32Value();
_this->SetState(state);
}
}
示例14: FetchModeSetter
void ODBCResult::FetchModeSetter(Local<String> property, Local<Value> value, const AccessorInfo &info) {
HandleScope scope;
ODBCResult *obj = ObjectWrap::Unwrap<ODBCResult>(info.Holder());
if (value->IsNumber()) {
obj->m_fetchMode = value->Int32Value();
}
}
示例15: SetLocationPort
static void SetLocationPort(Local<String> name, Local<Value> val, const AccessorInfo& info)
{
Local<Object> self = info.This();
Local<Value> x = self->GetInternalField(0);
Local<External> wrap = Local<External>::Cast(x);
void* ptr = wrap->Value();
jsLocation* url = static_cast<jsLocation*>(ptr);
url->url.port = val->Int32Value();
}