MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / getCParamTypeLength

Method getCParamTypeLength

scripts/generator.py:1204–1231  ·  view source on GitHub ↗

Return the length of the type field is an indented, formatted declaration for a ` ` or ` ` block (e.g. function parameter or structure/union member). - param - Element (` ` or ` `) to identify

(self, param)

Source from the content-addressed store, hash-verified

1202 return paramdecl
1203
1204 def getCParamTypeLength(self, param):
1205 """Return the length of the type field is an indented, formatted
1206 declaration for a `<param>` or `<member>` block (e.g. function parameter
1207 or structure/union member).
1208
1209 - param - Element (`<param>` or `<member>`) to identify"""
1210 if self.genOpts is None:
1211 raise MissingGeneratorOptionsError()
1212 if self.genOpts.conventions is None:
1213 raise MissingGeneratorOptionsConventionsError()
1214
1215 # Allow for missing <name> tag
1216 newLen = 0
1217 paramdecl = f" {noneStr(param.text)}"
1218 for elem in param:
1219 text = noneStr(elem.text)
1220 tail = noneStr(elem.tail)
1221
1222 if self.should_insert_may_alias_macro and self.genOpts.conventions.is_voidpointer_alias(elem.tag, text, tail):
1223 # OpenXR-specific macro insertion
1224 tail = self.genOpts.conventions.make_voidpointer_alias(tail)
1225 if elem.tag == 'name':
1226 # Align at specified column, if possible
1227 newLen = len(paramdecl.rstrip())
1228 self.logMsg('diag', 'Identifying length of', elem.text, 'as', newLen)
1229 paramdecl += text + tail
1230
1231 return newLen
1232
1233 def getMaxCParamTypeLength(self, info):
1234 """Return the length of the longest type field for a member/parameter.

Callers 1

Calls 6

logMsgMethod · 0.95
is_voidpointer_aliasMethod · 0.80
noneStrFunction · 0.70

Tested by

no test coverage detected