tools/json_schema_compiler/cpp_type_generator.py
def _TypeDependencies(self, type_, hard=False):
    """Gets all the type dependencies of a property.
    """
    deps = set()
    if type_.property_type == PropertyType.REF:
      underlying_type = self._FindType(type_.ref_type)
      # Enums from other namespaces are always hard dependencies, since
      # optional enums are represented via the _NONE value instead of a
      # pointer.
      dep_is_hard = (True if underlying_type.property_type == PropertyType.ENUM
                     else hard)
      deps.add(_TypeDependency(underlying_type, hard=dep_is_hard))
    elif type_.property_type == PropertyType.ARRAY:
      # Types in containers are hard dependencies because they are stored
      # directly and use move semantics.
      deps = self._TypeDependencies(type_.item_type, hard=hard)
    elif type_.property_type == PropertyType.CHOICES:
      for type_ in type_.choices:
        deps |= self._TypeDependencies(type_, hard=self.IsCopyable(type_))
    elif type_.property_type == PropertyType.OBJECT:
      for p in type_.properties.values():
        deps |= self._TypeDependencies(p.type_, hard=not p.optional)
    return deps
Gets all the type dependencies of a property.
    
Gets all the type dependencies of a property.
Gets all the type dependencies of a property .
def _TypeDependencies(self, type_, hard=False):
    deps = set()
    if type_.property_type == PropertyType.REF:
      underlying_type = self._FindType(type_.ref_type)
      dep_is_hard = (True if underlying_type.property_type == PropertyType.ENUM
                     else hard)
      deps.add(_TypeDependency(underlying_type, hard=dep_is_hard))
    elif type_.property_type == PropertyType.ARRAY:
      deps = self._TypeDependencies(type_.item_type, hard=hard)
    elif type_.property_type == PropertyType.CHOICES:
      for type_ in type_.choices:
        deps |= self._TypeDependencies(type_, hard=self.IsCopyable(type_))
    elif type_.property_type == PropertyType.OBJECT:
      for p in type_.properties.values():
        deps |= self._TypeDependencies(p.type_, hard=not p.optional)
    return deps
def _TypeDependencies ( self , type_ , hard = False ) : deps = set ( ) if type_ . property_type == PropertyType . REF : underlying_type = self . _FindType ( type_ . ref_type ) dep_is_hard = ( True if underlying_type . property_type == PropertyType . ENUM else hard ) deps . add ( _TypeDependency ( underlying_type , hard = dep_is_hard ) ) elif type_ . property_type == PropertyType . ARRAY : deps = self . _TypeDependencies ( type_ . item_type , hard = hard ) elif type_ . property_type == PropertyType . CHOICES : for type_ in type_ . choices : deps |= self . _TypeDependencies ( type_ , hard = self . IsCopyable ( type_ ) ) elif type_ . property_type == PropertyType . OBJECT : for p in type_ . properties . values ( ) : deps |= self . _TypeDependencies ( p . type_ , hard = not p . optional ) return deps
Gets all the type dependencies of a property.
Gets all the type dependencies of a property .
"""Gets all the type dependencies of a property.
    """ # Enums from other namespaces are always hard dependencies, since # optional enums are represented via the _NONE value instead of a # pointer. # Types in containers are hard dependencies because they are stored # directly and use move semantics.
self
type_
hard