tools/json_to_struct/element_generator.py
def GenerateFieldContent(element_name, field_info, content, lines, indent,
                         field_name_count):
  """Generate the content of a field to be included in the static structure
  initializer. If the field's content is not specified, uses the default value
  if one exists.
  """
  if content is None:
    content = field_info.get('default', None)
  type = field_info['type']
  if type in ('int', 'enum', 'class'):
    lines.append('%s%s,' % (indent, content))
  elif type == 'string':
    _GenerateString(content, lines, indent)
  elif type == 'string16':
    _GenerateString16(content, lines, indent)
  elif type == 'array':
    _GenerateArray(element_name, field_info, content, lines, indent,
                   field_name_count)
  elif type == 'struct':
    _GenerateStruct(element_name, field_info, content, lines, indent,
                    field_name_count)
  else:
    raise RuntimeError('Unknown field type "%s"' % type)
Generate the content of a field to be included in the static structure
  initializer. If the field's content is not specified, uses the default value
  if one exists.
  
Generate the content of a field to be included in the static structure
initializer. If the field's content is not specified, uses the default value
if one exists.
Generate the content of a field to be included in the static structure initializer . If the field ' s content is not specified uses the default value if one exists .
def GenerateFieldContent(element_name, field_info, content, lines, indent,
                         field_name_count):
  if content is None:
    content = field_info.get('default', None)
  type = field_info['type']
  if type in ('int', 'enum', 'class'):
    lines.append('%s%s,' % (indent, content))
  elif type == 'string':
    _GenerateString(content, lines, indent)
  elif type == 'string16':
    _GenerateString16(content, lines, indent)
  elif type == 'array':
    _GenerateArray(element_name, field_info, content, lines, indent,
                   field_name_count)
  elif type == 'struct':
    _GenerateStruct(element_name, field_info, content, lines, indent,
                    field_name_count)
  else:
    raise RuntimeError('Unknown field type "%s"' % type)
def GenerateFieldContent ( element_name , field_info , content , lines , indent , field_name_count ) : if content is None : content = field_info . get ( 'default' , None ) type = field_info [ 'type' ] if type in ( 'int' , 'enum' , 'class' ) : lines . append ( '%s%s,' % ( indent , content ) ) elif type == 'string' : _GenerateString ( content , lines , indent ) elif type == 'string16' : _GenerateString16 ( content , lines , indent ) elif type == 'array' : _GenerateArray ( element_name , field_info , content , lines , indent , field_name_count ) elif type == 'struct' : _GenerateStruct ( element_name , field_info , content , lines , indent , field_name_count ) else : raise RuntimeError ( 'Unknown field type "%s"' % type )
Generate the content of a field to be included in the static structure
initializer.
Generate the content of a field to be included in the static structure initializer .
"""Generate the content of a field to be included in the static structure
  initializer. If the field's content is not specified, uses the default value
  if one exists.
  """
element_name
field_info
content
lines
indent
field_name_count