예제 #1
0
파일: cxxparser.py 프로젝트: yanqzhi/c2py
 def _process_enum(self, c: Cursor, parent: AnyCxxSymbol,
                   store_global: bool):
     e = Enum(
         name=c.spelling,
         parent=parent,
         location=location_from_cursor(c),
         type=c.enum_type.spelling,
         is_strong_typed=c.is_scoped_enum(),
         brief_comment=c.brief_comment,
     )
     for i in list(c.get_children()):
         e.variables[i.spelling] = Variable(
             parent=e,
             name=i.spelling,
             location=location_from_cursor(i),
             type=e.name,
             value=i.enum_value,
             brief_comment=c.brief_comment,
         )
     if store_global:
         self.objects[e.full_name] = e
     return e
예제 #2
0
    def _process_class(self,
                       c: Cursor,
                       parent: AnyCxxSymbol,
                       store_global: bool,
                       name: str = ''):
        """
        :param name: name it with specific name.
        """
        # noinspection PyArgumentList
        if not name:
            name = c.spelling
        class_ = Class(
            name=name,
            parent=parent,
            location=location_from_cursor(c),
            brief_comment=c.brief_comment,
        )
        for ac in c.get_children():
            self._process_class_child(ac, class_, store_global=store_global)

        if store_global:
            self.objects[class_.full_name] = class_
        return class_
예제 #3
0
파일: cxxparser.py 프로젝트: yanqzhi/c2py
 def _get_template_alias_target(self, c: Cursor):
     children = list(c.get_children())
     for child in children:
         if child.kind == CursorKind.TYPE_ALIAS_DECL:
             return child.underlying_typedef_type
     return None