本文整理汇总了C++中TestInterface2类的典型用法代码示例。如果您正苦于以下问题:C++ TestInterface2类的具体用法?C++ TestInterface2怎么用?C++ TestInterface2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestInterface2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: keysMethod
static void keysMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface2", "keys");
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
ScriptState* scriptState = ScriptState::forReceiverObject(info);
Iterator* result = impl->keysForBinding(scriptState, exceptionState);
if (exceptionState.hadException()) {
return;
}
v8SetReturnValue(info, result);
}
开发者ID:mirror,项目名称:chromium,代码行数:13,代码来源:V8TestInterface2.cpp
示例2: namedPropertyDeleter
static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
if (!name->IsString())
return;
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
v8::String::Utf8Value namedProperty(name);
ExceptionState exceptionState(ExceptionState::DeletionContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (result != DeleteUnknownProperty)
return v8SetReturnValueBool(info, result == DeleteSuccess);
}
开发者ID:,项目名称:,代码行数:14,代码来源:
示例3: namedPropertyEnumerator
static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
{
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
Vector<String> names;
ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInterface2", info.Holder(), info.GetIsolate());
impl->namedPropertyEnumerator(names, exceptionState);
if (exceptionState.throwIfNeeded())
return;
v8::Local<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size());
for (size_t i = 0; i < names.size(); ++i) {
if (!v8CallBoolean(v8names->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), i, v8String(info.GetIsolate(), names[i]))))
return;
}
v8SetReturnValue(info, v8names);
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例4: namedPropertyQuery
static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
if (!name->IsString())
return;
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
v8::String::Utf8Value namedProperty(name);
ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
bool result = impl->namedPropertyQuery(propertyName, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (!result)
return;
v8SetReturnValueInt(info, v8::None);
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例5: indexedPropertyGetter
static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetterContext, "TestInterface2");
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
// We assume that all the implementations support length() method, although
// the spec doesn't require that length() must exist. It's okay that
// the interface does not have length attribute as long as the
// implementation supports length() member function.
if (index >= impl->length())
return; // Returns undefined due to out-of-range.
TestInterfaceEmpty* result = impl->item(index, exceptionState);
v8SetReturnValueFast(info, result, impl);
}
开发者ID:mirror,项目名称:chromium,代码行数:15,代码来源:V8TestInterface2.cpp
示例6: namedPropertyGetter
static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;
auto nameString = name.As<v8::String>();
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(nameString);
v8::String::Utf8Value namedProperty(nameString);
ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
TestInterfaceEmpty* result = impl->namedItem(propertyName, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (!result)
return;
v8SetReturnValueFast(info, result, impl);
}
开发者ID:,项目名称:,代码行数:16,代码来源:
示例7: indexedPropertySetter
static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), v8Value);
ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInterface2", info.Holder(), info.GetIsolate());
if (!propertyValue) {
exceptionState.throwTypeError("The provided value is not of type 'TestInterfaceEmpty'.");
exceptionState.throwIfNeeded();
return;
}
bool result = impl->setItem(index, propertyValue, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (!result)
return;
v8SetReturnValue(info, v8Value);
}
开发者ID:,项目名称:,代码行数:17,代码来源:
示例8: namedPropertySetter
static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
const CString& nameInUtf8 = name.utf8();
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestInterface2", nameInUtf8.data());
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!propertyValue && !isUndefinedOrNull(v8Value)) {
exceptionState.throwTypeError("The provided value is not of type 'TestInterfaceEmpty'.");
return;
}
bool result = impl->setNamedItem(name, propertyValue, exceptionState);
if (exceptionState.hadException())
return;
if (!result)
return;
v8SetReturnValue(info, v8Value);
}
开发者ID:mirror,项目名称:chromium,代码行数:18,代码来源:V8TestInterface2.cpp
示例9: itemMethod
static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface2", "item");
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
unsigned index;
index = toUInt32(info.GetIsolate(), info[0], NormalConversion, exceptionState);
if (exceptionState.hadException())
return;
TestInterfaceEmpty* result = impl->item(index, exceptionState);
if (exceptionState.hadException()) {
return;
}
v8SetReturnValue(info, result);
}
开发者ID:mirror,项目名称:chromium,代码行数:21,代码来源:V8TestInterface2.cpp
示例10: deleteNamedItemMethod
static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionContext, "TestInterface2", "deleteNamedItem");
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
return;
}
V8StringResource<> name;
name = info[0];
if (!name.prepare())
return;
bool result = impl->deleteNamedItem(name, exceptionState);
if (exceptionState.hadException()) {
return;
}
v8SetReturnValueBool(info, result);
}
开发者ID:mirror,项目名称:chromium,代码行数:21,代码来源:V8TestInterface2.cpp
示例11: itemMethod
static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "TestInterface2", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
setMinimumArityTypeError(exceptionState, 1, info.Length());
exceptionState.throwIfNeeded();
return;
}
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
unsigned index;
{
index = toUInt32(info.GetIsolate(), info[0], NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
}
TestInterfaceEmpty* result = impl->item(index, exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValue(info, result);
}
开发者ID:,项目名称:,代码行数:22,代码来源:
示例12: deleteNamedItemMethod
static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamedItem", "TestInterface2", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
setMinimumArityTypeError(exceptionState, 1, info.Length());
exceptionState.throwIfNeeded();
return;
}
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
V8StringResource<> name;
{
name = info[0];
if (!name.prepare())
return;
}
bool result = impl->deleteNamedItem(name, exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValueBool(info, result);
}
开发者ID:,项目名称:,代码行数:22,代码来源:
示例13: namedPropertySetter
static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
if (!name->IsString())
return;
auto nameString = name.As<v8::String>();
v8::String::Utf8Value namedProperty(nameString);
ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
V8StringResource<> propertyName(nameString);
if (!propertyName.prepare())
return;
TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!propertyValue && !isUndefinedOrNull(v8Value)) {
exceptionState.throwTypeError("The provided value is not of type 'TestInterfaceEmpty'.");
exceptionState.throwIfNeeded();
return;
}
bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState);
if (exceptionState.throwIfNeeded())
return;
if (!result)
return;
v8SetReturnValue(info, v8Value);
}
开发者ID:,项目名称:,代码行数:24,代码来源:
示例14: toStringMethod
static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate());
}
开发者ID:,项目名称:,代码行数:5,代码来源:
示例15: constructor
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestInterface2* impl = TestInterface2::create();
v8::Local<v8::Object> wrapper = info.Holder();
wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterface2::wrapperTypeInfo, wrapper);
v8SetReturnValue(info, wrapper);
}
开发者ID:mirror,项目名称:chromium,代码行数:6,代码来源:V8TestInterface2.cpp
注:本文中的TestInterface2类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论