tools/json_to_struct/json_to_struct.py
def GenerateStruct(basepath, output_root, namespace, schema, description,
                   description_filename, schema_filename, year=None):
  """Generates a C++ struct from a JSON description.

  Args:
    basepath: The base directory in which files are generated.
    output_root: The filename and path, relative to basepath, of the file to
        create, without an extension.
    namespace: A string corresponding to the C++ namespace to use.
    schema: A dict containing the schema. See comment at the top of this file.
    description: A dict containing the description. See comment at the top of
        this file.
    description_filename: The description filename. This is added to the
        header of the outputted files.
    schema_filename: The schema filename. This is added to the header of the
        outputted files.
    year: Year to display next to the copy-right in the header.
  """
  year = int(year) if year else datetime.now().year
  head = HEAD % (year, schema_filename, description_filename)
  _GenerateH(basepath, output_root, head, namespace, schema, description)
  _GenerateCC(basepath, output_root, head, namespace, schema, description)
Generates a C++ struct from a JSON description.

  Args:
    basepath: The base directory in which files are generated.
    output_root: The filename and path, relative to basepath, of the file to
        create, without an extension.
    namespace: A string corresponding to the C++ namespace to use.
    schema: A dict containing the schema. See comment at the top of this file.
    description: A dict containing the description. See comment at the top of
        this file.
    description_filename: The description filename. This is added to the
        header of the outputted files.
    schema_filename: The schema filename. This is added to the header of the
        outputted files.
    year: Year to display next to the copy-right in the header.
  
Generates a C++ struct from a JSON description.
Generates a C ++ struct from a JSON description .
def GenerateStruct(basepath, output_root, namespace, schema, description,
                   description_filename, schema_filename, year=None):
  year = int(year) if year else datetime.now().year
  head = HEAD % (year, schema_filename, description_filename)
  _GenerateH(basepath, output_root, head, namespace, schema, description)
  _GenerateCC(basepath, output_root, head, namespace, schema, description)
def GenerateStruct ( basepath , output_root , namespace , schema , description , description_filename , schema_filename , year = None ) : year = int ( year ) if year else datetime . now ( ) . year head = HEAD % ( year , schema_filename , description_filename ) _GenerateH ( basepath , output_root , head , namespace , schema , description ) _GenerateCC ( basepath , output_root , head , namespace , schema , description )
Generates a C++ struct from a JSON description.
Generates a C ++ struct from a JSON description .
"""Generates a C++ struct from a JSON description.

  Args:
    basepath: The base directory in which files are generated.
    output_root: The filename and path, relative to basepath, of the file to
        create, without an extension.
    namespace: A string corresponding to the C++ namespace to use.
    schema: A dict containing the schema. See comment at the top of this file.
    description: A dict containing the description. See comment at the top of
        this file.
    description_filename: The description filename. This is added to the
        header of the outputted files.
    schema_filename: The schema filename. This is added to the header of the
        outputted files.
    year: Year to display next to the copy-right in the header.
  """
basepath
The base directory in which files are generated.
The base directory in which files are generated .
output_root
The filename and path, relative to basepath, of the file to
create, without an extension.
The filename and path relative to basepath of the file to create without an extension .
namespace
A string corresponding to the C++ namespace to use.
A string corresponding to the C ++ namespace to use .
schema
A dict containing the schema. See comment at the top of this file.
A dict containing the schema . See comment at the top of this file .
description
A dict containing the description. See comment at the top of
this file.
A dict containing the description . See comment at the top of this file .
description_filename
The description filename. This is added to the
header of the outputted files.
The description filename . This is added to the header of the outputted files .
schema_filename
The schema filename. This is added to the header of the
outputted files.
The schema filename . This is added to the header of the outputted files .
year
Year to display next to the copy-right in the header.
Year to display next to the copy - right in the header .