本文整理汇总了C++中Reference::createObject方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::createObject方法的具体用法?C++ Reference::createObject怎么用?C++ Reference::createObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::createObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: componentsLocker
Reference<SceneObject*> SceneObjectImplementation::getCraftedComponentsSatchel() {
Reference<SceneObject*> sceno = asSceneObject();
if (sceno == NULL)
return NULL;
Reference<ZoneServer*> zServer = getZoneServer();
if(zServer == NULL)
return NULL;
ManagedReference<SceneObject*> craftingComponents = sceno->getSlottedObject("crafted_components");
ManagedReference<SceneObject*> craftingComponentsSatchel = NULL;
if(craftingComponents == NULL) {
/// Add Components to crafted object
String craftingComponentsPath = "object/tangible/crafting/crafting_components_container.iff";
craftingComponents = zServer->createObject(craftingComponentsPath.hashCode(), 1);
Locker componentsLocker(craftingComponents);
craftingComponents->setSendToClient(false);
sceno->transferObject(craftingComponents, 4, false);
craftingComponents->setContainerDefaultDenyPermission(ContainerPermissions::OPEN + ContainerPermissions::MOVEIN + ContainerPermissions::MOVEOUT + ContainerPermissions::MOVECONTAINER);
craftingComponents->setContainerDefaultAllowPermission(0);
craftingComponents->setContainerDenyPermission("owner", ContainerPermissions::OPEN + ContainerPermissions::MOVEIN + ContainerPermissions::MOVEOUT + ContainerPermissions::MOVECONTAINER);
craftingComponents->setContainerDenyPermission("admin", ContainerPermissions::OPEN + ContainerPermissions::MOVEIN + ContainerPermissions::MOVEOUT + ContainerPermissions::MOVECONTAINER);
craftingComponents->setContainerAllowPermission("owner", 0);
craftingComponents->setContainerAllowPermission("admin", 0);
craftingComponents->setContainerInheritPermissionsFromParent(false);
//String craftingComponentsSatchelPath = "object/tangible/container/base/base_container_volume.iff";
String craftingComponentsSatchelPath = "object/tangible/hopper/crafting_station_hopper/crafting_station_ingredient_hopper_large.iff";
craftingComponentsSatchel = zServer->createObject(craftingComponentsSatchelPath.hashCode(), 1);
Locker satchelLocker(craftingComponentsSatchel, craftingComponents);
craftingComponentsSatchel->setContainerInheritPermissionsFromParent(false);
craftingComponentsSatchel->setContainerDefaultDenyPermission(ContainerPermissions::OPEN + ContainerPermissions::MOVEIN + ContainerPermissions::MOVEOUT + ContainerPermissions::MOVECONTAINER);
craftingComponentsSatchel->setContainerDefaultAllowPermission(0);
craftingComponentsSatchel->setContainerAllowPermission("admin", ContainerPermissions::OPEN);
craftingComponentsSatchel->setContainerDenyPermission("admin", ContainerPermissions::MOVEIN + ContainerPermissions::MOVEOUT + ContainerPermissions::MOVECONTAINER);
craftingComponentsSatchel->setContainerAllowPermission("owner", 0);
craftingComponentsSatchel->setContainerDenyPermission("owner", ContainerPermissions::OPEN + ContainerPermissions::MOVEIN + ContainerPermissions::MOVEOUT + ContainerPermissions::MOVECONTAINER);
craftingComponents->transferObject(craftingComponentsSatchel, -1, false);
} else {
craftingComponentsSatchel = craftingComponents->getContainerObject(0);
}
return craftingComponentsSatchel;
}
示例2: create_struct_ex
void create_struct_ex(zval *retval, Any *anyval, char *str, int str_len TSRMLS_DC)
{
Reference <XIdlReflection> *x_idl_reflec_p;
int type;
int rsrc_id;
try
{
//restore XIdlReflection resource
x_idl_reflec_p =
(Reference <XIdlReflection> *) zend_list_find(
PUNO_G(x_idl_reflec_rsrc_id),&type);
TEST_PTR(x_idl_reflec_p,);
Reference <XIdlClass> xIdlClass = (*x_idl_reflec_p)->forName(OUString(str,str_len,RTL_TEXTENCODING_ISO_8859_15,OSTRING_TO_OUSTRING_CVTFLAGS));
TEST_PTR(xIdlClass.is(),);
//Reference <XIdlField2> field (xidlfield, UNO_QUERY);
Any any_obj;
xIdlClass->createObject(any_obj);
if(anyval!=NULL)
{
any_obj.setValue((*anyval).getValue(),(*anyval).getValueType());
}
Any *any_obj_p= new Any(any_obj);
TEST_PTR(any_obj_p,);
//init object
object_init_ex (retval, ce_ptr);
puno_class_object *new_struct_p;
new_struct_p =
(puno_class_object *) zend_object_store_get_object(retval TSRMLS_CC);
TEST_PTR(new_struct_p,);
//type is Structs
new_struct_p->type = TypeClass_STRUCT;
//register and store the Any object
rsrc_id = ZEND_REGISTER_RESOURCE (
NULL, any_obj_p,
uno_any_rsrc_dtor);
TEST_PTR(rsrc_id,);
new_struct_p->this_rsrc_id = rsrc_id;
//register and store the XIdlClass Interface
Reference <XIdlClass> *x_idl_class_p=new Reference <XIdlClass> (xIdlClass);
TEST_PTR(x_idl_class_p,);
rsrc_id = ZEND_REGISTER_RESOURCE (
NULL, x_idl_class_p,
uno_refer_rsrc_dtor);
TEST_PTR(rsrc_id,);
new_struct_p->x_idl_class_rsrc_id = rsrc_id;
}
catch(Exception& e)
{
//throw PHP EXCEPTION
zend_throw_exception(zend_exception_get_default(),(char *)OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr(),0 TSRMLS_CC);
}
}