本文整理汇总了C++中Local::GetPointerFromInternalField方法的典型用法代码示例。如果您正苦于以下问题:C++ Local::GetPointerFromInternalField方法的具体用法?C++ Local::GetPointerFromInternalField怎么用?C++ Local::GetPointerFromInternalField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Local
的用法示例。
在下文中一共展示了Local::GetPointerFromInternalField方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getValueObjectWriteCount
Handle<Value> getValueObjectWriteCount(const Arguments &args) {
HandleScope scope;
Local<Object> obj = args[0]->ToObject();
NdbRecordObject * nro =
static_cast<NdbRecordObject *>(obj->GetPointerFromInternalField(1));
return scope.Close(Number::New(nro->getWriteCount()));
}
示例2:
void* Get<void*> (Handle<Value> value) {
void *ptr = NULL;
if (value->IsObject()) {
Local<Object> object = value->ToObject();
if (object->InternalFieldCount()) {
ptr = object->GetPointerFromInternalField(0);
}
}
return ptr;
}
示例3: object
static void
gum_script_file_on_destroy (Persistent<Value> value,
void * data)
{
(void) data;
HandleScope handle_scope;
Local<Object> object (value->ToObject ());
FILE * file = static_cast<FILE *> (object->GetPointerFromInternalField (0));
if (file != NULL)
fclose (file);
value.Dispose ();
}
示例4: ThrowException
static Handle<Value> require_file(const Arguments &args) //读取js文件
{
HandleScope scope;
if(!args[0]->IsString()){
return ThrowException(Exception::TypeError(String::New("require(filepath): filapath must needed")));
}
Local<Object> Gobj = args.This();
String::Utf8Value* dirname_p = (String::Utf8Value*) Gobj->GetPointerFromInternalField(0);
std::string dirname = **dirname_p;
//c++利用js函数加工处理参数,这里让c++利用 _object_toString
Local<Object> path_resolve_obj = Script::Compile(String::New(path_resolve_js))->Run()->ToObject();
#ifdef WIN32
Local<Object> path_resolve_func = path_resolve_obj->Get(String::New("resolve_win"))->ToObject();
#else
Local<Object> path_resolve_func = path_resolve_obj->Get(String::New("resolve_linux"))->ToObject();
#endif
Local<Value> argv[2];
argv[0] = String::New(dirname.c_str());
argv[1] = args[0];
Local<Value> path_str_value = path_resolve_func->CallAsFunction(Object::New(), 2, argv);
String::Utf8Value utf8_value(path_str_value->ToString());
std::string path_str = *utf8_value;
char *file = readFile(String::New(path_str.c_str()));
TryCatch onError;
Script::Compile(String::New(file))->Run();
if(onError.HasCaught()){
std::string err_str= "require has error";
err_str += path_str;
return ThrowException(Exception::TypeError(String::New(err_str.c_str())));
}
return scope.Close(Gobj);
}
示例5: DisposeOpenCLObject
void DisposeOpenCLObject (Persistent<Value> value, void* release) {
if (release && value->IsObject()) {
Local<Object> object = value->ToObject();
if (object->InternalFieldCount()) {
void *ptr = object->GetPointerFromInternalField(0);
int32_t (CALL *clRelease) (void* smth);
*(void**) &clRelease = release;
clRelease(ptr); // Returned value is omitted. Check when debugging.
}
}
value.Dispose();
value.Clear();
}
示例6: isValueObject
Handle<Value> isValueObject(const Arguments &args) {
HandleScope scope;
bool answer = false;
Handle<Value> v = args[0];
if(v->IsObject()) {
Local<Object> o = v->ToObject();
if(o->InternalFieldCount() == 2) {
Envelope * n = (Envelope *) o->GetPointerFromInternalField(0);
if(n == & nroEnvelope) {
answer = true;
}
}
}
return scope.Close(Boolean::New(answer));
}
示例7: Init
void NativeStatusIcon::Init(Settings* settings) {
char* iconFile = settings->getString("icon","");
char* tooltip = settings->getString("tooltip","");
bool visible = settings->getBoolean("visible",true);
// TODO local or persistent?
Local<Object> menu = settings->getObject("menu");
NativeMenu* nativeMenu;
GtkStatusIcon *statusIcon;
if( settings->has("icon") ) {
statusIcon = gtk_status_icon_new_from_file(iconFile);
} else {
statusIcon = gtk_status_icon_new_from_stock(GTK_STOCK_MISSING_IMAGE);
}
statusIconHandle_ = statusIcon;
if( settings->has("tooltip") ) {
gtk_status_icon_set_tooltip_text(statusIcon, tooltip);
gtk_status_icon_set_title(statusIcon,tooltip);
}
if( settings->has("menu") ) {
GtkWidget* gtkMenu = gtk_menu_new();
nativeMenu = (NativeMenu*)menu->GetPointerFromInternalField(0);
nativeMenu->Attach(GTK_MENU_SHELL(gtkMenu));
g_signal_connect(statusIcon, "popup-menu", GTK_SIGNAL_FUNC (status_icon_show_menu), gtkMenu);
}
g_signal_connect(statusIcon, "activate", G_CALLBACK(status_icon_click), this);
g_signal_connect(statusIcon, "popup-menu", G_CALLBACK(status_icon_popup), this);
gtk_status_icon_set_visible(statusIcon, visible);
}