本文整理汇总了Python中properties.Properties.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.merge方法的具体用法?Python Properties.merge怎么用?Python Properties.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类properties.Properties
的用法示例。
在下文中一共展示了Properties.merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Object
# 需要导入模块: from properties import Properties [as 别名]
# 或者: from properties.Properties import merge [as 别名]
class Object():
LayerType = 0
MapObjectType = 1
MapType = 2
TerrainType = 3
TilesetType = 4
TileType = 5
def __init__(self, arg):
tp = type(arg)
self.mProperties = Properties()
if tp==int:
self.mTypeId = arg
elif tp==Object:
self.mTypeId = arg.mTypeId
self.mProperties = arg.mProperties
##
# Virtual destructor.
##
def __del__(self):
pass
##
# Returns the type of this object.
##
def typeId(self):
return self.mTypeId
##
# Returns the properties of this object.
##
def properties(self):
return self.mProperties
##
# Replaces all existing properties with a new set of properties.
##
def setProperties(self, properties):
self.mProperties = properties
##
# Merges \a properties with the existing properties. Properties with the
# same name will be overridden.
#
# \sa Properties.merge
##
def mergeProperties(self, properties):
self.mProperties.merge(properties)
##
# Returns the value of the object's \a name property.
##
def property(self, name):
return self.mProperties.value(name,'')
##
# Returns whether this object has a property with the given \a name.
##
def hasProperty(self, name):
return self.mProperties.contains(name)
##
# Sets the value of the object's \a name property to \a value.
##
def setProperty(self, name, value):
self.mProperties.insert(name, value)
##
# Removes the property with the given \a name.
##
def removeProperty(self, name):
self.mProperties.remove(name)