Generate groups (e.g. C "enum" type). These are concatenated together with other types. If alias is not None, it is the name of another group type which aliases this type; just generate that alias.
(self, groupinfo, groupName, alias=None)
| 495 | self.appendSection('struct', body) |
| 496 | |
| 497 | def genGroup(self, groupinfo, groupName, alias=None): |
| 498 | """Generate groups (e.g. C "enum" type). |
| 499 | |
| 500 | These are concatenated together with other types. |
| 501 | |
| 502 | If alias is not None, it is the name of another group type |
| 503 | which aliases this type; just generate that alias.""" |
| 504 | OutputGenerator.genGroup(self, groupinfo, groupName, alias) |
| 505 | groupElem = groupinfo.elem |
| 506 | |
| 507 | # After either enumerated type or alias paths, add the declaration |
| 508 | # to the appropriate section for the group being defined. |
| 509 | if groupElem.get('type') == 'bitmask': |
| 510 | section = 'bitmask' |
| 511 | else: |
| 512 | section = 'group' |
| 513 | |
| 514 | if alias: |
| 515 | # If the group name is aliased, just emit a typedef declaration |
| 516 | # for the alias. |
| 517 | body = f"typedef {alias} {groupName};\n" |
| 518 | self.appendSection(section, body) |
| 519 | else: |
| 520 | if self.genOpts is None: |
| 521 | raise MissingGeneratorOptionsError() |
| 522 | (section, body) = self.buildEnumCDecl(self.genOpts.genEnumBeginEndRange, groupinfo, groupName) |
| 523 | self.appendSection(section, f"\n{body}") |
| 524 | |
| 525 | def genEnum(self, enuminfo, name, alias): |
| 526 | """Generate the C declaration for a constant (a single <enum> value). |
nothing calls this directly
no test coverage detected