本文整理汇总了C++中AccessorInfo::This方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessorInfo::This方法的具体用法?C++ AccessorInfo::This怎么用?C++ AccessorInfo::This使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessorInfo
的用法示例。
在下文中一共展示了AccessorInfo::This方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Undefined
Handle<Value> ArrayType::PlatformLengthGet(Local<String> property, const AccessorInfo& info) {
HandleScope scope;
jobject ob = (jobject)info.This()->GetPointerFromInternalField(0);
ArrayType *arr = (ArrayType *)info.This()->GetPointerFromInternalField(1);
JNIEnv *jniEnv = arr->env->getVM()->getJNIEnv();
jint length = jniEnv->CallIntMethod(ob, arr->getLength);
if(arr->env->getConv()->CheckForException(jniEnv)) {
return Undefined();
}
return scope.Close(Integer::New(length));
}
示例2: ClassNameSetter
void Widget::ClassNameSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
if (value->IsString()) {
ClutterActor *instance = ObjectWrap::Unwrap<Actor>(info.This())->_actor;
ObjectWrap::Unwrap<Widget>(info.This())->hasClassName = TRUE;
mx_stylable_set_style_class(MX_STYLABLE(instance), *String::Utf8Value(value->ToString()));
mx_stylable_set_style(MX_STYLABLE(instance), mx_style_get_default());
}
}
示例3: PlatformLengthSet
void ArrayType::PlatformLengthSet(Local<String> property, Local<Value> value, const AccessorInfo& info) {
HandleScope scope;
jobject ob = (jobject)info.This()->GetPointerFromInternalField(0);
ArrayType *arr = (ArrayType *)info.This()->GetPointerFromInternalField(1);
JNIEnv *jniEnv = arr->env->getVM()->getJNIEnv();
if(value.IsEmpty()) {
ThrowException(Exception::ReferenceError(String::New("No value specified")));
return;
}
jint length = (jint)value->IntegerValue();
jniEnv->CallVoidMethod(ob, arr->setLength, length);
arr->env->getConv()->CheckForException(jniEnv);
}
示例4:
Handle<v8::Value> Function::GetOnlyReadsMemory (Local<String> property, const AccessorInfo& info)
{
HandleScope scope;
Function* fun = ObjectWrap::Unwrap<Function>(info.This());
Handle<v8::Value> result = Boolean::New(fun->llvm_fun->onlyReadsMemory());
return scope.Close(result);
}
示例5: 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();
}
示例6: if
Handle<Value> Layer::get_prop(Local<String> property,
const AccessorInfo& info)
{
HandleScope scope;
Layer* l = ObjectWrap::Unwrap<Layer>(info.This());
std::string a = TOSTR(property);
if (a == "name")
return scope.Close(String::New(l->layer_->name().c_str()));
else if (a == "srs")
return scope.Close(String::New(l->layer_->srs().c_str()));
else if (a == "styles") {
std::vector<std::string> const& style_names = l->layer_->styles();
Local<Array> s = Array::New(style_names.size());
for (unsigned i = 0; i < style_names.size(); ++i)
{
s->Set(i, String::New(style_names[i].c_str()) );
}
return scope.Close(s);
}
else if (a == "datasource") {
mapnik::datasource_ptr ds = l->layer_->datasource();
if (ds)
{
return scope.Close(Datasource::New(ds));
}
}
return Undefined();
}
示例7:
void
Image::SetOnerror(Local<String>, Local<Value> val, const AccessorInfo &info) {
if (val->IsFunction()) {
Image *img = ObjectWrap::Unwrap<Image>(info.This());
img->onerror = Persistent<Function>::New(Handle<Function>::Cast(val));
}
}
示例8:
void
NodeSandbox::node_setDebugOnCrash(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
SandboxWrapper* wrap;
wrap = node::ObjectWrap::Unwrap<SandboxWrapper>(info.This());
wrap->sbox->m_debuggerOnCrash = value->ToBoolean()->Value();
}
示例9: New
Handle<Value>
NodeSandbox::node_getDebugOnCrash(Local<String> property, const AccessorInfo& info)
{
SandboxWrapper* wrap;
wrap = node::ObjectWrap::Unwrap<SandboxWrapper>(info.This());
return Boolean::New (wrap->sbox->m_debuggerOnCrash);
}
示例10:
Handle<Array> jsWindow::WindowEnum( const AccessorInfo &info )
{
HandleScope scope;
Handle<Array> retval = Local<Array>::New(Array::New());
Local<Object> self = info.This();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
void* ptr = wrap->Value();
jsWindow* el = static_cast<jsWindow*>(ptr);
map<string, int> prop_list;
size_t i;
for (i = 0; i < ro_props.size(); ++i) {
prop_list[ro_props[i]] = 1;
}
jsPropertyMap::iterator it;
for (it = el->props.begin(); it != el->props.end(); ++it) {
prop_list[it->first] = 1;
}
map<string, int>::iterator ins;
i = 0;
for (ins = prop_list.begin(); ins != prop_list.end(); ++ins) {
string val = ins->first;
retval->Set(Number::New(i), String::New(val.c_str()));
i++;
}
return scope.Close(retval);
}
示例11: justificationSetter
void FieldDefn::justificationSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
{
HandleScope scope;
FieldDefn *def = ObjectWrap::Unwrap<FieldDefn>(info.This());
OGRJustification justification;
std::string str = TOSTR(value);
if(value->IsString()){
if(str == "Left") {
justification = OJLeft;
} else if (str == "Right") {
justification = OJRight;
} else if (str == "Undefined") {
justification = OJUndefined;
} else {
NODE_THROW("Unrecognized justification");
return;
}
} else if (value->IsNull() || value->IsUndefined()){
justification = OJUndefined;
} else {
NODE_THROW("justification must be a string or undefined");
return;
}
def->this_->SetJustify(justification);
}
示例12: SetSize
void NodeFFT::SetSize (Local<String> property, Local<Value> value, const AccessorInfo &info) {
NodeFFT *nfft = ObjectWrap::Unwrap<NodeFFT>(info.This());
if (!nfft->reset(value->Uint32Value())) {
/* TODO: Throw an error somehow */
}
}
示例13: 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();
}
示例14: New
Handle<Value> Base_GetA(Local<String> property, const AccessorInfo &info)
{
Base* ptr = GetObjectPtr(info.This());
assert(ptr);
return Integer::New(ptr->a);
}
示例15:
Handle<Value> Widget::ClassNameGetter(Local<String> name, const AccessorInfo& info)
{
HandleScope scope;
/* This widget has no class name */
if (!ObjectWrap::Unwrap<Widget>(info.This())->hasClassName) {
return scope.Close(
String::New("")
);
}
ClutterActor *instance = ObjectWrap::Unwrap<Actor>(info.This())->_actor;
return scope.Close(
String::New(mx_stylable_get_style_class(MX_STYLABLE(instance)))
);
}