本文整理汇总了C++中Local::GetConstructorName方法的典型用法代码示例。如果您正苦于以下问题:C++ Local::GetConstructorName方法的具体用法?C++ Local::GetConstructorName怎么用?C++ Local::GetConstructorName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Local
的用法示例。
在下文中一共展示了Local::GetConstructorName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsInheritTemplate
bool IsInheritTemplate(Handle<Value> val,uint tid){
if(!val->IsObject()) return false;
Local<Function> func = GetEnv()->GetTemplate(tid)->GetFunction();
Local<Object> obj = val->ToObject()->GetPrototype()->ToObject();
while(true){
if(obj->GetPrototype()->IsNull()) return false;
if(obj->GetConstructorName()==func->GetName()->ToString()) return true;
obj = obj->GetPrototype()->ToObject();
}
}
示例2: exists
TEST_F(JSDeviceTest, createIstance) {
V8_SETUP
EXPECT_CALL(*zDevices.get(), exists(extAddress)).WillOnce(Return(true));
v8::Local<v8::Value> result = runScript(creatingZDeviceScript + "a;");
String::Utf8Value utf8(result);
ASSERT_THAT(result.IsEmpty(), false);
ASSERT_THAT(result->IsObject(), true);
Local<Object> object = result->ToObject();
ASSERT_THAT(object->GetConstructorName(), IsString(JSZDEVICE));
}
示例3: exists
TEST_F( JSEndpointTest, createIstance) {
ZEndpoint zEndpoint { NWK_ADDRESS, ENDPOINT_ID, PROFILE_ID, DEVICE_ID, DEVICE_VER, IN_CLUSTERS, OUT_CLUSTERS };
ZDevice zDevice { extAddress, NWK_ADDRESS, 0, { zEndpoint } };
std::stringstream stream { };
stream << JSZENDPOINT << "('" << EXTENDED_ADDRESS << "', " << ENDPOINT_ID << ");";
V8_SETUP
jsEndpoint->initJsObjectsTemplate(isolate, global);
EXPECT_CALL(*zDevices.get(), exists(extAddress)).WillOnce(Return(true));
EXPECT_CALL(*zDevices.get(), getDevice(extAddress)).WillOnce(Return(&zDevice));
v8::Local<v8::Value> result = runScript(stream.str());
ASSERT_THAT(result.IsEmpty(), false);
ASSERT_THAT(result->IsObject(), true);
Local<Object> object = result->ToObject();
ASSERT_THAT(object->GetConstructorName(), IsString(JSZENDPOINT));
}
示例4: createIstanceTest
void JSAttributeTest::createIstanceTest(const std::string &attributeName, std::shared_ptr<JSZAttribute> &jsZAttribute,
std::shared_ptr<ZCLAttribute> attributeMock) {
ZEndpoint zEndpoint{NWK_ADDRESS, ENDPOINT_ID, PROFILE_ID, DEVICE_ID, DEVICE_VER, IN_CLUSTERS, OUT_CLUSTERS};
ZDevice zDevice{extAddress, NWK_ADDRESS, 0, {zEndpoint}};
std::stringstream stream{};
stream << attributeName << "('" << EXTENDED_ADDRESS << "', " << ENDPOINT_ID << ", " << CLUSTER_ID << "," << ATTRIBUTE0_ID << ");";
V8_SETUP
jsZAttribute->initJsObjectsTemplate(isolate, global);
EXPECT_CALL(*zDevices, exists(extAddress)).WillOnce(Return(true));
EXPECT_CALL(*zDevices, getDevice(extAddress)).WillOnce(Return(&zDevice));
EXPECT_CALL(*clusterTypeFactoryMock, getCluster(CLUSTER_ID, zigbeeDevice, ENDPOINT_ID, NWK_ADDRESS)).WillOnce(Return(cluster));
EXPECT_CALL(*cluster, getAttribute(ATTRIBUTE0_ID)).WillOnce(Return(attributeMock));
v8::Local<v8::Value> result = runScript(stream.str());
ASSERT_THAT(result.IsEmpty(), false);
ASSERT_THAT(result->IsObject(), true);
Local<Object> object = result->ToObject();
ASSERT_THAT(object->GetConstructorName(), IsString(attributeName));
}