本文整理汇总了C++中Persistent::IsObject方法的典型用法代码示例。如果您正苦于以下问题:C++ Persistent::IsObject方法的具体用法?C++ Persistent::IsObject怎么用?C++ Persistent::IsObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Persistent
的用法示例。
在下文中一共展示了Persistent::IsObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: RemoveFromComponentMap
bool ScriptSystem::RemoveFromComponentMap(dtEntity::ComponentType ct, dtEntity::EntityId eid)
{
ComponentMap::iterator it = mComponentMap.find(std::make_pair(ct, eid));
if(it == mComponentMap.end())
{
return false;
}
HandleScope scope;
Persistent<Object> obj = it->second;
assert(!obj.IsEmpty() && obj->IsObject());
// invalidate component wrapper
obj->SetInternalField(0, External::New(0));
obj.Dispose();
mComponentMap.erase(it);
V8::AdjustAmountOfExternalAllocatedMemory(-(int)sizeof(dtEntity::Component));
return true;
}
示例3: context_scope
static Persistent<Object> getPlugin(shared_ptr<PluginContext> script)
{
Context::Scope context_scope(script->getContext());
HandleScope handleScope;
Handle<Object> global = script->getContext()->Global();
if (global->Has(String::New("plugin")) == false)
{
throw IllegalArgumentException("Expected the script to have exports.");
}
Handle<Value> pluginValue = global->Get(String::New("plugin"));
Persistent<Object> plugin = Persistent<Object>::New(Handle<Object>::Cast(pluginValue));
if (plugin.IsEmpty() || plugin->IsObject() == false)
{
throw IllegalArgumentException("Expected plugin to be a valid object.");
}
return plugin;
}