本文整理汇总了C++中AccessorInfo::Data方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessorInfo::Data方法的具体用法?C++ AccessorInfo::Data怎么用?C++ AccessorInfo::Data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessorInfo
的用法示例。
在下文中一共展示了AccessorInfo::Data方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nroGetter
/* Generic getter for all NdbRecordObjects
*/
Handle<Value> nroGetter(Local<String>, const AccessorInfo & info)
{
NdbRecordObject * nro =
static_cast<NdbRecordObject *>(info.Holder()->GetPointerFromInternalField(1));
int nField = info.Data()->Int32Value();
return nro->getField(nField);
}
示例2: nroSetter
/* Generic setter for all NdbRecordObjects
*/
void nroSetter(Local<String>, Local<Value> value, const AccessorInfo& info)
{
NdbRecordObject * nro =
static_cast<NdbRecordObject *>(info.Holder()->GetPointerFromInternalField(1));
int nField = info.Data()->Int32Value();
nro->setField(nField, value);
}
示例3: Undefined
Handle<Value> Interface::PlatformAttrGet(Local<String> property, const AccessorInfo& info) {
HandleScope scope;
jobject ob = (jobject)info.This()->GetPointerFromInternalField(0);
int attrData = info.Data()->Int32Value();
int attrIdx = attrData & 0xffff;
int clsid = attrData >> 16;
Env *env = Env::getEnv_nocheck();
Interface *interface = env->getInterface(clsid);
if(interface) {
Attribute *attr = interface->attributes->addr(attrIdx);
JNIEnv *jniEnv = interface->env->getVM()->getJNIEnv();
jniEnv->PushLocalFrame(256);
jobject jVal = jniEnv->CallStaticObjectMethod(interface->jPlatformStub, interface->jPlatformGet, ob, attrIdx);
if(env->getConv()->CheckForException(jniEnv)) {
jniEnv->PopLocalFrame(0);
return Undefined();
}
Local<Value> val;
int result = interface->conv->ToV8Value(jniEnv, jVal, attr->type, &val);
jniEnv->PopLocalFrame(0);
if(result == OK) {
return scope.Close(val);
}
interface->conv->ThrowV8ExceptionForErrno(result);
}
return Undefined();
}
示例4: BrowserGet
static Handle<Value> BrowserGet(Local<String> name, const AccessorInfo &info)
{
HandleScope scope;
Handle<Value> val;
std::string key = value_to_string(name);
LOG4CXX_TRACE(webEngine::iLogger::GetLogger(), _T("jsBrowserGet: property(")<< key <<_T(")"));
Local<External> wrap = Local<External>::Cast(info.Data());
void* ptr = wrap->Value();
jsBrowser* el = static_cast<jsBrowser*>(ptr);
if (key == "v8_context") {
val = v8_wrapper::wrap_object<jsExecutor>(el);
} else if (key == "v8_results") {
val = String::New(el->get_results().c_str());
} else if (key == "window") {
val = v8_wrapper::wrap_object<jsWindow>(el->window);
} else if (el->window->is_property(key)) {
val = el->window->GetProperty(name, info);
} else {
// Look up the value if it exists using the standard STL idiom.
jsPropertyMap::iterator iter = el->props.find(key);
// If the key is not present return an empty handle as signal.
if (iter != el->props.end()) {
// Otherwise fetch the value and wrap it in a JavaScript string.
val = Local<Value>::New(iter->second);
}
}
return scope.Close(val);
}
示例5: setVectorY
void vectorTemplate::setVectorY(Local<String> property, Local<Value> value, const AccessorInfo &info){
Local<External> data = Local<External>::Cast(info.Data());
vector<double> *vect = reinterpret_cast<vector<double> *>(data->Value());
if(value->IsNumber()){
vect->y = value->ToNumber()->Value();
}
}
示例6:
Handle<Value> jsBrowser::GetWindow( Local<String> name, const AccessorInfo &info )
{
HandleScope scope;
Local<External> wrap = Local<External>::Cast(info.Data());
void* ptr = wrap->Value();
jsBrowser* el = static_cast<jsBrowser*>(ptr);
Handle<Object> _obj = v8_wrapper::wrap_object<jsWindow>(el->window);
return scope.Close(_obj);
}
示例7: ThrowError
Handle<Value> COPropertyGetter(Local<String> propname, const AccessorInfo& info)
{
dtEntity::Component* component = UnwrapComponent(info.Holder());
if(component == NULL)
{
return ThrowError("Trying to access deleted component!");
}
HandleScope scope;
Handle<External> ext = Handle<External>::Cast(info.Data());
dtEntity::Property* prop = static_cast<dtEntity::Property*>(ext->Value());
switch(prop->GetDataType())
{
case dtEntity::DataType::ARRAY:
case dtEntity::DataType::VEC2:
case dtEntity::DataType::VEC2D:
case dtEntity::DataType::VEC3:
case dtEntity::DataType::VEC3D:
case dtEntity::DataType::VEC4:
case dtEntity::DataType::VEC4D:
case dtEntity::DataType::GROUP:
case dtEntity::DataType::MATRIX:
case dtEntity::DataType::QUAT:
{
Handle<Value> v;// = info.Holder()->GetHiddenValue(propname);
if(true)//v.IsEmpty())
{
v = ConvertPropertyToValue(info.Holder()->CreationContext(), prop);
// info.Holder()->SetHiddenValue(propname, v);
}
else
{
Handle<Value> ret = SetValueFromProperty(prop, v);
if(ret->BooleanValue() == false) {
return ThrowError("Internal error: Did property change type on the fly?");
}
}
return scope.Close(v);
}
default:
return scope.Close(ConvertPropertyToValue(info.Holder()->CreationContext(), prop));
}
}
示例8: BrowserSet
static Handle<Value> BrowserSet(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
Handle<Value> val;
std::string key = value_to_string(name);
LOG4CXX_TRACE(webEngine::iLogger::GetLogger(), _T("jsBrowserSet: property(")<< key <<_T(")"));
Local<External> wrap = Local<External>::Cast(info.Data());
void* ptr = wrap->Value();
if (ptr != NULL) {
jsBrowser* el = static_cast<jsBrowser*>(ptr);
if (key == "v8_results") {
string sval = value_to_string(value);
el->append_results(sval);
} else if (el->window->is_property(key)) {
val = el->window->GetProperty(name, info);
} else {
el->props[key] = Persistent<Value>::New(value);
}
}
return val;
}
示例9: COPropertySetter
void COPropertySetter(Local<String> propname,
Local<Value> value,
const AccessorInfo& info)
{
assert(!info.Holder().IsEmpty());
dtEntity::Component* component = UnwrapComponent(info.Holder());
if(component == NULL)
{
LOG_ERROR("Trying to access deleted component!");
return;
}
HandleScope scope;
Handle<External> ext = Handle<External>::Cast(info.Data());
dtEntity::Property* prop = static_cast<dtEntity::Property*>(ext->Value());
assert(prop);
SetPropertyFromValue(value, prop);
#if CALL_ONPROPERTYCHANGED_METHOD
component->OnPropertyChanged(dtEntity::SIDHash(ToStdString(propname)), *prop);
#endif
}
示例10: PlatformAttrSet
void Interface::PlatformAttrSet(Local<String> property, Local<Value> value, const AccessorInfo& info) {
HandleScope scope;
jobject ob = (jobject)info.This()->GetPointerFromInternalField(0);
int attrData = info.Data()->Int32Value();
int attrIdx = attrData & 0xffff;
int clsid = attrData >> 16;
Env *env = Env::getEnv_nocheck();
Interface *interface = env->getInterface(clsid);
if(interface) {
Attribute *attr = interface->attributes->addr(attrIdx);
JNIEnv *jniEnv = interface->env->getVM()->getJNIEnv();
jniEnv->PushLocalFrame(256);
jobject jVal;
int result = interface->conv->ToJavaObject(jniEnv, value, attr->type, &jVal);
if(result == OK) {
jniEnv->CallStaticVoidMethod(interface->jPlatformStub, interface->jPlatformSet, ob, attrIdx, jVal);
}
jniEnv->PopLocalFrame(0);
if(result == OK)
env->getConv()->CheckForException(jniEnv);
else
interface->conv->ThrowV8ExceptionForErrno(result);
}
}
示例11:
Handle<Value> vectorTemplate::getVectorY(Local<String> property, const AccessorInfo &info){
HandleScope scope;
Local<External> data = Local<External>::Cast(info.Data());
vector<double> *vect = reinterpret_cast<vector<double> *>(data->Value());
return scope.Close(Number::New(vect->y));
}