How to use the pygccxml.declarations.hierarchy_info_t function in pygccxml

To help you get started, we’ve selected a few pygccxml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gccxml / pygccxml / unittests / core_tester.py View on Github external
def _test_is_based_and_derived(self, base, derived, access):
        dhi_v = declarations.hierarchy_info_t(derived, access, True)
        dhi_not_v = declarations.hierarchy_info_t(derived, access, False)
        self.assertTrue(
            dhi_v in base.derived or dhi_not_v in base.derived,
            "base class '%s' doesn't has derived class '%s'" %
            (base.name, derived.name))

        bhi_v = declarations.hierarchy_info_t(base, access, True)
        bhi_not_v = declarations.hierarchy_info_t(base, access, False)

        self.assertTrue(
            bhi_v in derived.bases or bhi_not_v in derived.bases,
            "derive class '%s' doesn't has base class '%s'" %
            (derived.name, base.name))
github gccxml / pygccxml / unittests / core_tester.py View on Github external
def _test_is_based_and_derived(self, base, derived, access):
        dhi_v = declarations.hierarchy_info_t(derived, access, True)
        dhi_not_v = declarations.hierarchy_info_t(derived, access, False)
        self.assertTrue(
            dhi_v in base.derived or dhi_not_v in base.derived,
            "base class '%s' doesn't has derived class '%s'" %
            (base.name, derived.name))

        bhi_v = declarations.hierarchy_info_t(base, access, True)
        bhi_not_v = declarations.hierarchy_info_t(base, access, False)

        self.assertTrue(
            bhi_v in derived.bases or bhi_not_v in derived.bases,
            "derive class '%s' doesn't has base class '%s'" %
            (derived.name, base.name))
github InsightSoftwareConsortium / ITK / parser / linker.py View on Github external
if '.' in decl._name or '$' in decl._name:
                decl._name = new_name

        bases = self.__inst.bases.split()
        self.__inst.bases = []
        for base in bases:
            # it could be "_5" or "protected:_5"
            data = base.split(':')
            base_decl = self.__decls[data[-1]]
            access = declarations.ACCESS_TYPES.PUBLIC
            if len(data) == 2:
                access = data[0]
            self.__inst.bases.append(
                declarations.hierarchy_info_t(base_decl, access))
            base_decl.derived.append(
                declarations.hierarchy_info_t(self.__inst, access))
github InsightSoftwareConsortium / ITK / parser / project_reader.py View on Github external
leaved_class = leaved_classes[self._create_key(class_)]
            for base_info in class_.bases:
                leaved_base = leaved_classes[
                    self._create_key(base_info.related_class)]
                # treating base class hierarchy of leaved_class
                leaved_base_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_base, access=base_info.access)
                if leaved_base_info not in leaved_class.bases:
                    leaved_class.bases.append(leaved_base_info)
                else:
                    index = leaved_class.bases.index(leaved_base_info)
                    leaved_class.bases[
                        index].related_class = leaved_base_info.related_class
                # treating derived class hierarchy of leaved_base
                leaved_derived_for_base_info = \
                    pygccxml.declarations.hierarchy_info_t(
                        related_class=leaved_class,
                        access=base_info.access)
                if leaved_derived_for_base_info not in leaved_base.derived:
                    leaved_base.derived.append(leaved_derived_for_base_info)
                else:
                    index = leaved_base.derived.index(
                        leaved_derived_for_base_info)
                    leaved_base.derived[index].related_class = \
                        leaved_derived_for_base_info.related_class
            for derived_info in class_.derived:
                leaved_derived = leaved_classes[
                    self._create_key(
                        derived_info.related_class)]
                # treating derived class hierarchy of leaved_class
                leaved_derived_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_derived, access=derived_info.access)
github gccxml / pygccxml / pygccxml / parser / project_reader.py View on Github external
index = leaved_base.derived.index(
                        leaved_derived_for_base_info)
                    leaved_base.derived[index].related_class = \
                        leaved_derived_for_base_info.related_class
            for derived_info in class_.derived:
                leaved_derived = leaved_classes[
                    self._create_key(
                        derived_info.related_class)]
                # treating derived class hierarchy of leaved_class
                leaved_derived_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_derived, access=derived_info.access)
                if leaved_derived_info not in leaved_class.derived:
                    leaved_class.derived.append(leaved_derived_info)
                # treating base class hierarchy of leaved_derived
                leaved_base_for_derived_info = \
                    pygccxml.declarations.hierarchy_info_t(
                        related_class=leaved_class,
                        access=derived_info.access)
                if leaved_base_for_derived_info not in leaved_derived.bases:
                    leaved_derived.bases.append(leaved_base_for_derived_info)
        # this loops remove instance we from parent.declarations
        for class_ in classes:
            key = self._create_key(class_)
            if id(leaved_classes[key]) == id(class_):
                continue
            else:
                if class_.parent:
                    declarations = class_.parent.declarations
                else:
                    # yes, we are talking about global class that doesn't
                    # belong to any namespace. Usually is compiler generated
                    # top level classes
github gccxml / pygccxml / pygccxml / parser / project_reader.py View on Github external
if isinstance(decl, pygccxml.declarations.class_t)]
        leaved_classes = {}
        # selecting classes to leave
        for class_ in classes:
            key = self._create_key(class_)
            if key not in leaved_classes:
                leaved_classes[key] = class_
        # replacing base and derived classes with those that should be leave
        # also this loop will add missing derived classes to the base
        for class_ in classes:
            leaved_class = leaved_classes[self._create_key(class_)]
            for base_info in class_.bases:
                leaved_base = leaved_classes[
                    self._create_key(base_info.related_class)]
                # treating base class hierarchy of leaved_class
                leaved_base_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_base, access=base_info.access)
                if leaved_base_info not in leaved_class.bases:
                    leaved_class.bases.append(leaved_base_info)
                else:
                    index = leaved_class.bases.index(leaved_base_info)
                    leaved_class.bases[
                        index].related_class = leaved_base_info.related_class
                # treating derived class hierarchy of leaved_base
                leaved_derived_for_base_info = \
                    pygccxml.declarations.hierarchy_info_t(
                        related_class=leaved_class,
                        access=base_info.access)
                if leaved_derived_for_base_info not in leaved_base.derived:
                    leaved_base.derived.append(leaved_derived_for_base_info)
                else:
                    index = leaved_base.derived.index(
github gccxml / pygccxml / pygccxml / msvc / mspdb / loader.py View on Github external
def __load_base_classes( self ):
        make_hi = declarations.hierarchy_info_t
        is_base_class = lambda smbl: smbl.symTag == msdia.SymTagBaseClass \
                                     and False == smbl.indirectVirtualBaseClass
        self.logger.info( 'building class hierarchies' )
        for count, smbl in enumerate( itertools.ifilter( is_base_class, self.symbols.itervalues() ) ):
            base_id = smbl.type.symIndexId
            derived_id = smbl.classParentId

            if base_id not in self.public_classes or derived_id not in self.public_classes:
                continue

            hi_base = make_hi( self.__id2decl[base_id]
                               , self.__guess_access_type( smbl )
                               , bool( smbl.virtualBaseClass ) )
            self.__id2decl[ derived_id ].bases.append( hi_base )

            hi_derived = make_hi( self.__id2decl[derived_id]
github cpc / tce / tce / Python-bindings / tools / pygccxml / pygccxml / parser / project_reader.py View on Github external
, access=base_info.access )
                if leaved_derived_for_base_info not in leaved_base.derived:
                    leaved_base.derived.append( leaved_derived_for_base_info )
                else:
                    index = leaved_base.derived.index( leaved_derived_for_base_info )
                    leaved_base.derived[index].related_class = leaved_derived_for_base_info.related_class
            for derived_info in class_.derived:
                leaved_derived = leaved_classes[ create_key( derived_info.related_class ) ]
                #treating derived class hierarchy of leaved_class
                leaved_derived_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_derived
                    , access=derived_info.access )
                if leaved_derived_info not in leaved_class.derived:
                    leaved_class.derived.append( leaved_derived_info )
                #treating base class hierarchy of leaved_derived
                leaved_base_for_derived_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_class
                    , access=derived_info.access )
                if leaved_base_for_derived_info not in leaved_derived.bases:
                    leaved_derived.bases.append( leaved_base_for_derived_info )
        #this loops remove instance we from parent.declarations
        for class_ in classes:
            key = create_key( class_ )
            if id( leaved_classes[key] ) == id( class_ ):
                continue
            else:
                declarations = None
                if class_.parent:
                    declarations = class_.parent.declarations
                else:
                    declarations = namespaces #yes, we are talking about global class that doesn't
                    #belong to any namespace. Usually is compiler generated top level classes
github InsightSoftwareConsortium / ITK / parser / project_reader.py View on Github external
index = leaved_base.derived.index(
                        leaved_derived_for_base_info)
                    leaved_base.derived[index].related_class = \
                        leaved_derived_for_base_info.related_class
            for derived_info in class_.derived:
                leaved_derived = leaved_classes[
                    self._create_key(
                        derived_info.related_class)]
                # treating derived class hierarchy of leaved_class
                leaved_derived_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_derived, access=derived_info.access)
                if leaved_derived_info not in leaved_class.derived:
                    leaved_class.derived.append(leaved_derived_info)
                # treating base class hierarchy of leaved_derived
                leaved_base_for_derived_info = \
                    pygccxml.declarations.hierarchy_info_t(
                        related_class=leaved_class,
                        access=derived_info.access)
                if leaved_base_for_derived_info not in leaved_derived.bases:
                    leaved_derived.bases.append(leaved_base_for_derived_info)
        # this loops remove instance we from parent.declarations
        for class_ in classes:
            key = self._create_key(class_)
            if id(leaved_classes[key]) == id(class_):
                continue
            else:
                if class_.parent:
                    declarations = class_.parent.declarations
                else:
                    # yes, we are talking about global class that doesn't
                    # belong to any namespace. Usually is compiler generated
                    # top level classes
github cpc / tce / tce / Python-bindings / tools / pygccxml / pygccxml / parser / project_reader.py View on Github external
classes = filter( lambda decl: isinstance(decl, pygccxml.declarations.class_t )
                          , pygccxml.declarations.make_flatten( namespaces ) )
        leaved_classes = {}
        #selecting classes to leave
        for class_ in classes:
            key = create_key( class_ )
            if key not in leaved_classes:
                leaved_classes[ key ] = class_
        #replacing base and derived classes with those that should be leave
        #also this loop will add missing derived classes to the base
        for class_ in classes:
            leaved_class = leaved_classes[create_key( class_ )]
            for base_info in class_.bases:
                leaved_base = leaved_classes[ create_key( base_info.related_class ) ]
                #treating base class hierarchy of leaved_class
                leaved_base_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_base
                    , access=base_info.access )
                if leaved_base_info not in leaved_class.bases:
                    leaved_class.bases.append( leaved_base_info )
                else:
                    index = leaved_class.bases.index( leaved_base_info )
                    leaved_class.bases[index].related_class = leaved_base_info.related_class
                #treating derived class hierarchy of leaved_base
                leaved_derived_for_base_info = pygccxml.declarations.hierarchy_info_t(
                    related_class=leaved_class
                    , access=base_info.access )
                if leaved_derived_for_base_info not in leaved_base.derived:
                    leaved_base.derived.append( leaved_derived_for_base_info )
                else:
                    index = leaved_base.derived.index( leaved_derived_for_base_info )
                    leaved_base.derived[index].related_class = leaved_derived_for_base_info.related_class