MCPcopy Create free account
hub / github.com/Kitware/CMake / __convert_node

Function __convert_node

Source/cmConvertMSBuildXMLToJSON.py:313–338  ·  view source on GitHub ↗

Converts a XML node to a JSON equivalent.

(node, default_value='', default_flags=vsflags())

Source from the content-addressed store, hash-verified

311
312
313def __convert_node(node, default_value='', default_flags=vsflags()):
314 """Converts a XML node to a JSON equivalent."""
315 name = __get_attribute(node, 'Name')
316 logging.debug('Found %s named %s', node.tagName, name)
317
318 converted = {}
319 converted['name'] = name
320
321 switch = __get_attribute(node, 'Switch')
322 separator = __get_attribute(node, 'Separator')
323 converted['switch'] = __normalize_switch(switch, separator)
324
325 converted['comment'] = __get_attribute(node, 'DisplayName')
326 converted['value'] = default_value
327
328 # Check for the Flags attribute in case it was created during preprocessing
329 flags = __get_attribute(node, 'Flags')
330
331 if flags:
332 flags = flags.split(',')
333 else:
334 flags = default_flags
335
336 converted['flags'] = flags
337
338 return converted
339
340
341def __check_for_flag(value):

Callers 4

__convert_enumFunction · 0.85
__convert_boolFunction · 0.85
__convert_string_listFunction · 0.85
__convert_stringFunction · 0.85

Calls 3

vsflagsFunction · 0.85
__get_attributeFunction · 0.85
__normalize_switchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…