If an API element is marked deprecated, return a brief comment describing why. Otherwise, return an empty string. - elem - Element of the API. API name is determined depending on the element tag. - indent - number of spaces to indent the comment
(self, elem, indent = 0)
| 596 | return False; |
| 597 | |
| 598 | def deprecationComment(self, elem, indent = 0): |
| 599 | """If an API element is marked deprecated, return a brief comment |
| 600 | describing why. |
| 601 | Otherwise, return an empty string. |
| 602 | |
| 603 | - elem - Element of the API. |
| 604 | API name is determined depending on the element tag. |
| 605 | - indent - number of spaces to indent the comment""" |
| 606 | |
| 607 | reason = elem.get('deprecated') |
| 608 | |
| 609 | # This is almost always the path taken. |
| 610 | if reason == None: |
| 611 | return '' |
| 612 | |
| 613 | # There is actually a deprecated attribute. |
| 614 | padding = indent * ' ' |
| 615 | |
| 616 | # Determine the API name. |
| 617 | if elem.tag == 'member' or elem.tag == 'param': |
| 618 | name = elem.find('.//name').text |
| 619 | else: |
| 620 | name = elem.get('name') |
| 621 | |
| 622 | if reason == 'aliased': |
| 623 | return f'{padding}// {name} is a legacy alias\n' |
| 624 | elif reason == 'unused': |
| 625 | return f'{padding}// {name} is legacy and not used\n' |
| 626 | elif reason == 'true': |
| 627 | return f'{padding}// {name} is legacy, but no reason was given in the API XML\n' |
| 628 | else: |
| 629 | # This can be caught by schema validation |
| 630 | self.logMsg('error', f"{name} has an unknown legacy attribute value '{reason}'") |
| 631 | exit(1) |
| 632 | |
| 633 | def buildEnumCDecl(self, expand, groupinfo, groupName): |
| 634 | """Generate the C declaration for an enum""" |
no test coverage detected