tools/json_schema_compiler/cpp_type_generator.py
def GeneratePropertyValues(self, prop, line, nodoc=False):
    """Generates the Code to display all value-containing properties.
    """
    c = Code()
    if not nodoc:
      c.Comment(prop.description)

    if prop.value is not None:
      cpp_type = self.GetCppType(prop.type_)
      cpp_value = prop.value
      cpp_name = prop.name

      if cpp_type == 'std::string':
        cpp_value = '"%s"' % cpp_value
        cpp_type = 'char'
        cpp_name = '%s[]' % cpp_name
      c.Append(line % {
        "type": cpp_type,
        "name": cpp_name,
        "value": cpp_value
      })
    else:
      has_child_code = False
      c.Sblock('namespace %s {' % prop.name)
      for child_property in prop.type_.properties.values():
        child_code = self.GeneratePropertyValues(child_property,
                                                 line,
                                                 nodoc=nodoc)
        if child_code:
          has_child_code = True
          c.Concat(child_code)
      c.Eblock('}  // namespace %s' % prop.name)
      if not has_child_code:
        c = None
    return c
Generates the Code to display all value-containing properties.
    
Generates the Code to display all value-containing properties.
Generates the Code to display all value - containing properties .
def GeneratePropertyValues(self, prop, line, nodoc=False):
    c = Code()
    if not nodoc:
      c.Comment(prop.description)
    if prop.value is not None:
      cpp_type = self.GetCppType(prop.type_)
      cpp_value = prop.value
      cpp_name = prop.name
      if cpp_type == 'std::string':
        cpp_value = '"%s"' % cpp_value
        cpp_type = 'char'
        cpp_name = '%s[]' % cpp_name
      c.Append(line % {
        "type": cpp_type,
        "name": cpp_name,
        "value": cpp_value
      })
    else:
      has_child_code = False
      c.Sblock('namespace %s {' % prop.name)
      for child_property in prop.type_.properties.values():
        child_code = self.GeneratePropertyValues(child_property,
                                                 line,
                                                 nodoc=nodoc)
        if child_code:
          has_child_code = True
          c.Concat(child_code)
      c.Eblock('}  // namespace %s' % prop.name)
      if not has_child_code:
        c = None
    return c
def GeneratePropertyValues ( self , prop , line , nodoc = False ) : c = Code ( ) if not nodoc : c . Comment ( prop . description ) if prop . value is not None : cpp_type = self . GetCppType ( prop . type_ ) cpp_value = prop . value cpp_name = prop . name if cpp_type == 'std::string' : cpp_value = '"%s"' % cpp_value cpp_type = 'char' cpp_name = '%s[]' % cpp_name c . Append ( line % { "type" : cpp_type , "name" : cpp_name , "value" : cpp_value } ) else : has_child_code = False c . Sblock ( 'namespace %s {' % prop . name ) for child_property in prop . type_ . properties . values ( ) : child_code = self . GeneratePropertyValues ( child_property , line , nodoc = nodoc ) if child_code : has_child_code = True c . Concat ( child_code ) c . Eblock ( '}  // namespace %s' % prop . name ) if not has_child_code : c = None return c
Generates the Code to display all value-containing properties.
Generates the Code to display all value - containing properties .
"""Generates the Code to display all value-containing properties.
    """
self
prop
line
nodoc