当前位置: 首页>>代码示例>>Python>>正文


Python ObjCGenerator.objc_setter_method_for_member方法代码示例

本文整理汇总了Python中objc_generator.ObjCGenerator.objc_setter_method_for_member方法的典型用法代码示例。如果您正苦于以下问题:Python ObjCGenerator.objc_setter_method_for_member方法的具体用法?Python ObjCGenerator.objc_setter_method_for_member怎么用?Python ObjCGenerator.objc_setter_method_for_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在objc_generator.ObjCGenerator的用法示例。


在下文中一共展示了ObjCGenerator.objc_setter_method_for_member方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _generate_setter_for_member

# 需要导入模块: from objc_generator import ObjCGenerator [as 别名]
# 或者: from objc_generator.ObjCGenerator import objc_setter_method_for_member [as 别名]
 def _generate_setter_for_member(self, domain, declaration, member):
     objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
     var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
     setter_method = ObjCGenerator.objc_setter_method_for_member(declaration, member)
     conversion_expression = ObjCGenerator.objc_to_protocol_expression_for_member(declaration, member, var_name)
     lines = []
     lines.append('- (void)set%s:(%s)%s' % (ucfirst(var_name), objc_type, var_name))
     lines.append('{')
     lines.append('    [super %s:%s forKey:@"%s"];' % (setter_method, conversion_expression, member.member_name))
     lines.append('}')
     return '\n'.join(lines)
开发者ID:samcook88,项目名称:webkit,代码行数:13,代码来源:generate_objc_protocol_types_implementation.py

示例2: _generate_setter_for_member

# 需要导入模块: from objc_generator import ObjCGenerator [as 别名]
# 或者: from objc_generator.ObjCGenerator import objc_setter_method_for_member [as 别名]
 def _generate_setter_for_member(self, domain, declaration, member):
     objc_type = self.objc_type_for_member(declaration, member)
     var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
     setter_method = ObjCGenerator.objc_setter_method_for_member(declaration, member)
     conversion_expression = self.objc_to_protocol_expression_for_member(declaration, member, var_name)
     lines = []
     lines.append('- (void)set%s:(%s)%s' % (ucfirst(var_name), objc_type, var_name))
     lines.append('{')
     objc_array_class = self.objc_class_for_array_type(member.type)
     if objc_array_class and objc_array_class.startswith(self.objc_prefix()):
         lines.append('    THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
     lines.append('    [super %s:%s forKey:@"%s"];' % (setter_method, conversion_expression, member.member_name))
     lines.append('}')
     return '\n'.join(lines)
开发者ID:caiolima,项目名称:webkit,代码行数:16,代码来源:generate_objc_protocol_types_implementation.py


注:本文中的objc_generator.ObjCGenerator.objc_setter_method_for_member方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。