Example #1
0
def swig_ignore( cfg, intro ):
    """ignored methods, enum values, enums"""
    ignored_cls = []
    for cls in intro.exported_classes():
        for m in cls.internal_methods():
            ignored_cls.append( m )
    lines = list(set( [ "%%ignore %s;" % introspect.qualified_name( r.gcc ) for r in ignored_cls ] ))
    lines.sort()
    ignored = "\n".join( lines )
    ignored_evals = set()
    for enum in intro.exported_enums():
        for v in enum.ignored_names():
            ignored_evals.add( (introspect.qualified_name(enum.gcc.parent), v ) )
    lines = [ "%%ignore %s::%s;" % ( r[0], r[1] ) for r in ignored_evals ]
    lines.sort()
    ignored = ignored + "\n" + "\n".join( lines )
    return ignored
Example #2
0
def swig_rename_types(cfg, intro):
    lst = []
    m = cfg['cpp_type_map']
    for cls in intro.exported_classes():
        cls_name = introspect.qualified_name(cls.gcc)
        if cls_name not in cfg['ref_counted']:
            lst.append('%%rename(%s) %s;' % (m[cls_name], cls_name))
        else:
            lst.append('%%ignore %s;' % cls_name)
            lst.append('%%template(%s) boost::intrusive_ptr<%s>;' % (m[cls_name], cls_name))
    lst.sort()
    return '\n'.join(lst)
Example #3
0
def output_classes(header, intro, cfg):
    header.write('\n\n/* ==== classes ==== */\n')
    classes = []
    pre = cfg['cpp_cls_order']
    for cls in intro.exported_classes():
        try:
            qname = introspect.qualified_name(cls.gcc)
            heapq.heappush(classes, (pre[qname], qname, cls))
        except KeyError:
            heapq.heappush(classes, (10000, qname, cls))
    # sort classes
    cls_l = []
    while classes:
        p, qname, cls = heapq.heappop(classes)
        cls_l.append((p, qname, cls))
    cls_l.sort()
    for p, qname, cls in cls_l:
        output_class(cls, header, intro, cfg)
Example #4
0
def output_classes(header, intro, cfg):
    header.write('\n\n/* ==== classes ==== */\n')
    classes = []
    pre = cfg['cpp_cls_order']
    for cls in intro.exported_classes():
        try:
            qname = introspect.qualified_name(cls.gcc)
            heapq.heappush(classes, (pre[qname], qname, cls))
        except KeyError:
            heapq.heappush(classes, (10000, qname, cls))
    # sort classes
    cls_l = []
    while classes:
        p, qname, cls = heapq.heappop(classes)
        cls_l.append((p, qname, cls))
    cls_l.sort()
    for p, qname, cls in cls_l:
        output_class(cls, header, intro, cfg)