Esempio n. 1
0
def output_class(cls, header, intro, cfg):
    substd = { 'c_handle' : gencommon.c_handle_from_cls(cls,cfg),
               'cpp_name' : gencommon.cls_from_cls(cls,cfg) }
    gencommon.update_dict(substd, cfg, 'c_handle_inc', 'c_handle_dec')
    decl_string = gencommon.decl_string_generic(cls)
    cls_body = get_class_body(decl_string in cfg['ref_counted'])
    cls_muster = Template(cls_body).safe_substitute(substd)
    body = []
    import sig
    s = sig.cpp_signature(cfg)
    methods = [(s.get(m), m) for m in cls.methods()]
    methods.sort()
    for sig, m in methods:
        body.append(cpp_indent(output_callable(m, cfg), 4))
    substd = { 'body' : "\n".join(body) }
    cls_def = Template(cls_muster).substitute(substd)
    header.write(cls_def)
Esempio n. 2
0
def output_class(cls, header, intro, cfg):
    substd = {
        'c_handle': gencommon.c_handle_from_cls(cls, cfg),
        'cpp_name': gencommon.cls_from_cls(cls, cfg)
    }
    gencommon.update_dict(substd, cfg, 'c_handle_inc', 'c_handle_dec')
    decl_string = gencommon.decl_string_generic(cls)
    cls_body = get_class_body(decl_string in cfg['ref_counted'])
    cls_muster = Template(cls_body).safe_substitute(substd)
    body = []
    import sig
    s = sig.cpp_signature(cfg)
    methods = [(s.get(m), m) for m in cls.methods()]
    methods.sort()
    for sig, m in methods:
        body.append(cpp_indent(output_callable(m, cfg), 4))
    substd = {'body': "\n".join(body)}
    cls_def = Template(cls_muster).substitute(substd)
    header.write(cls_def)
Esempio n. 3
0
def callable_body_returning_interface(callable_, cfg):
    cls = callable_.return_type()['base']
    return dict(invocation=form_invocation(callable_,cfg),
                 c_result_cls=gencommon.c_handle_from_cls(cls,cfg),
                 cpp_result_cls=gencommon.cls_from_cls(cls,cfg))
Esempio n. 4
0
def callable_body_returning_interface(callable_, cfg):
    cls = callable_.return_type()['base']
    return dict(invocation=form_invocation(callable_, cfg),
                c_result_cls=gencommon.c_handle_from_cls(cls, cfg),
                cpp_result_cls=gencommon.cls_from_cls(cls, cfg))