def generate_declaration(self, code_sink):
        if self.method.is_const:
            decl_post_modifiers = " const"
        else:
            decl_post_modifiers = ""

        if self.method.throw:
            decl_post_modifiers += " throw (%s)" % (", ".join([ex.full_name for ex in self.method.throw]),)

        params_list = ", ".join([join_ctype_and_name(param.ctype, param.name) for param in self.parameters])
        code_sink.writeln(
            "virtual %s %s(%s)%s;" % (self.return_value.ctype, self.method_name, params_list, decl_post_modifiers)
        )
示例#2
0
 def generate_parent_caller_method(self, code_sink):
     ## generate a '%s__parent_caller' method (static methods
     ## cannot "conquer" 'protected' access type, only regular
     ## instance methods).
     code_sink.writeln('inline %s %s__parent_caller(%s)' % (
             self.return_value.ctype,
             self.method_name,
             ', '.join([join_ctype_and_name(param.ctype, param.name) for param in self.parameters])
             ))
     if self.return_value.ctype == 'void':
         code_sink.writeln('{ %s::%s(%s); }' % (self.method.class_.full_name, self.method_name,
                                                ', '.join([param.name for param in self.parameters])))
     else:
         code_sink.writeln('{ return %s::%s(%s); }' % (self.method.class_.full_name, self.method_name,
                                                       ', '.join([param.name for param in self.parameters])))        
示例#3
0
    def generate_declaration(self, code_sink):
        if self.method.is_const:
            decl_post_modifiers = ' const'
        else:
            decl_post_modifiers = ''

        if self.method.throw:
            decl_post_modifiers += " throw (%s)" % (', '.join(
                [ex.full_name for ex in self.method.throw]), )

        params_list = ', '.join([
            join_ctype_and_name(param.ctype, param.name)
            for param in self.parameters
        ])
        code_sink.writeln("virtual %s %s(%s)%s;" %
                          (self.return_value.ctype, self.method_name,
                           params_list, decl_post_modifiers))
示例#4
0
 def generate_parent_caller_method(self, code_sink):
     ## generate a '%s__parent_caller' method (static methods
     ## cannot "conquer" 'protected' access type, only regular
     ## instance methods).
     code_sink.writeln(
         'inline %s %s__parent_caller(%s)' %
         (self.return_value.ctype, self.method_name, ', '.join([
             join_ctype_and_name(param.ctype, param.name)
             for param in self.parameters
         ])))
     if self.return_value.ctype == 'void':
         code_sink.writeln(
             '{ %s::%s(%s); }' %
             (self.method.class_.full_name, self.method_name, ', '.join(
                 [param.name for param in self.parameters])))
     else:
         code_sink.writeln(
             '{ return %s::%s(%s); }' %
             (self.method.class_.full_name, self.method_name, ', '.join(
                 [param.name for param in self.parameters])))