(self, unused_api, prop, unused_schema)
Annotate a Property with C++ specific elements.
Annotate a Property with C++ specific elements.
Annotate a Property with C ++ specific elements .
def AnnotateProperty(self, unused_api, prop, unused_schema):
    """Annotate a Property with C++ specific elements."""
    super(CppGenerator, self).AnnotateProperty(unused_api, prop, unused_schema)
    prop.SetTemplateValue('isPrimitive', self._IsPrimitiveType(prop.data_type))
    base_type = prop.data_type
    if base_type.GetTemplateValue('isContainer'):
      base_type = base_type.GetTemplateValue('baseType')

    try:
      has_parent = base_type.parent
    except AttributeError:
      has_parent = False

    if not base_type.GetTemplateValue('builtIn') and not has_parent:
      # Since the property's base type doesn't have a parent, the
      # base type may be safely used by a split accessor definition
      # at the top-level scope.
      #
      # Since the property's base type is not a built-in type, it
      # might be part of a set of mutually recursive types, which
      # can *only* be safely used by a split accessor definition at
      # the top-level scope, after all of the potentially recursive
      # class definitions have been emitted.
      #
      # So: we set the useSplitAccessor template value, causing C++
      # template expansion to declare the accessor methods for this
      # property as part of the object, but to define them separately
      # at the top-level scope.
      prop.SetTemplateValue('useSplitAccessor', True)

    self._HandleImports(prop)
    self.AnnotateDocumentation(prop)
def AnnotateProperty ( self , unused_api , prop , unused_schema ) : super ( CppGenerator , self ) . AnnotateProperty ( unused_api , prop , unused_schema ) prop . SetTemplateValue ( 'isPrimitive' , self . _IsPrimitiveType ( prop . data_type ) ) base_type = prop . data_type if base_type . GetTemplateValue ( 'isContainer' ) : base_type = base_type . GetTemplateValue ( 'baseType' ) try : has_parent = base_type . parent except AttributeError : has_parent = False if not base_type . GetTemplateValue ( 'builtIn' ) and not has_parent : # Since the property's base type doesn't have a parent, the # base type may be safely used by a split accessor definition # at the top-level scope. # # Since the property's base type is not a built-in type, it # might be part of a set of mutually recursive types, which # can *only* be safely used by a split accessor definition at # the top-level scope, after all of the potentially recursive # class definitions have been emitted. # # So: we set the useSplitAccessor template value, causing C++ # template expansion to declare the accessor methods for this # property as part of the object, but to define them separately # at the top-level scope. prop . SetTemplateValue ( 'useSplitAccessor' , True ) self . _HandleImports ( prop ) self . AnnotateDocumentation ( prop )