parameters: (idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_type=False, used_as_variadic_argument=False, used_in_cpp_sequence=False)
return_statement: return base_idl_type + '*'
docstring: Returns C++ type corresponding to IDL type.
  
      |idl_type| argument is of type IdlType, while return value is a string
  
      Args:
          idl_type:
              IdlType
          raw_type:
              bool, True if idl_type's raw/primitive C++ type should be returned.
          used_as_rvalue_type:
              bool, True if the C++ type is used as an argument or the return
              type of a method.
          used_as_variadic_argument:
              bool, True if the C++ type is used as a variadic argument of a method.
          used_in_cpp_sequence:
              bool, True if the C++ type is used as an element of a container.
              Containers can be an array, a sequence or a dictionary.
docstring_summary: Returns C++ type corresponding to IDL type.
docstring_tokens: Returns C ++ type corresponding to IDL type .
function: def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_type=False, used_as_variadic_argument=False, used_in_cpp_sequence=False):
      """Returns C++ type corresponding to IDL type.
  
      |idl_type| argument is of type IdlType, while return value is a string
  
      Args:
          idl_type:
              IdlType
          raw_type:
              bool, True if idl_type's raw/primitive C++ type should be returned.
          used_as_rvalue_type:
              bool, True if the C++ type is used as an argument or the return
              type of a method.
          used_as_variadic_argument:
              bool, True if the C++ type is used as a variadic argument of a method.
          used_in_cpp_sequence:
              bool, True if the C++ type is used as an element of a container.
              Containers can be an array, a sequence or a dictionary.
      """
      def string_mode():
          if extended_attributes.get('TreatNullAs') == 'EmptyString':
              return 'TreatNullAsEmptyString'
          if idl_type.is_nullable or extended_attributes.get('TreatNullAs') == 'NullString':
              if extended_attributes.get('TreatUndefinedAs') == 'NullString':
                  return 'TreatNullAndUndefinedAsNullString'
              return 'TreatNullAsNullString'
          return ''
  
      extended_attributes = extended_attributes or {}
      idl_type = idl_type.preprocessed_type
  
      # Array or sequence types
      if used_as_variadic_argument:
          native_array_element_type = idl_type
      else:
          native_array_element_type = idl_type.native_array_element_type
      if native_array_element_type:
          vector_type = cpp_ptr_type('Vector', 'HeapVector', native_array_element_type.gc_type)
          vector_template_type = cpp_template_type(vector_type, native_array_element_type.cpp_type_args(used_in_cpp_sequence=True))
          if used_as_rvalue_type:
              return 'const %s&' % vector_template_type
          return vector_template_type
  
      # Simple types
      base_idl_type = idl_type.base_type
  
      if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE:
          return base_idl_type
      if base_idl_type in CPP_INT_TYPES:
          return 'int'
      if base_idl_type in CPP_UNSIGNED_TYPES:
          return 'unsigned'
      if base_idl_type in CPP_SPECIAL_CONVERSION_RULES:
          return CPP_SPECIAL_CONVERSION_RULES[base_idl_type]
  
      if base_idl_type in NON_WRAPPER_TYPES:
          return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % base_idl_type
      if idl_type.is_string_type:
          if not raw_type:
              return 'String'
          return 'V8StringResource<%s>' % string_mode()
  
      if idl_type.is_array_buffer_or_view and raw_type:
          return idl_type.implemented_as + '*'
      if idl_type.is_interface_type:
          implemented_as_class = idl_type.implemented_as
          if raw_type or (used_as_rvalue_type and idl_type.is_garbage_collected):
              return implemented_as_class + '*'
          new_type = 'Member' if used_in_cpp_sequence else 'RawPtr'
          ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPtr'), new_type, idl_type.gc_type)
          return cpp_template_type(ptr_type, implemented_as_class)
      if idl_type.is_dictionary:
          return base_idl_type
      if idl_type.is_union_type:
          # Avoid "AOrNullOrB" for cpp type of (A? or B) because we generate
          # V8AOrBOrNull to handle nulle for (A? or B), (A or B?) and (A or B)?
          def member_cpp_name(idl_type):
              if idl_type.is_nullable:
                  return idl_type.inner_type.name
              return idl_type.name
          idl_type_name = "Or".join(member_cpp_name(member)
                                    for member in idl_type.member_types)
          return 'const %s&' % idl_type_name if used_as_rvalue_type else idl_type_name
  
      # Default, assume native type is a pointer with same type name as idl type
      return base_idl_type + '*'
function_tokens: def cpp_type ( idl_type , extended_attributes = None , raw_type = False , used_as_rvalue_type = False , used_as_variadic_argument = False , used_in_cpp_sequence = False ) : def string_mode ( ) : if extended_attributes . get ( 'TreatNullAs' ) == 'EmptyString' : return 'TreatNullAsEmptyString' if idl_type . is_nullable or extended_attributes . get ( 'TreatNullAs' ) == 'NullString' : if extended_attributes . get ( 'TreatUndefinedAs' ) == 'NullString' : return 'TreatNullAndUndefinedAsNullString' return 'TreatNullAsNullString' return '' extended_attributes = extended_attributes or { } idl_type = idl_type . preprocessed_type # Array or sequence types if used_as_variadic_argument : native_array_element_type = idl_type else : native_array_element_type = idl_type . native_array_element_type if native_array_element_type : vector_type = cpp_ptr_type ( 'Vector' , 'HeapVector' , native_array_element_type . gc_type ) vector_template_type = cpp_template_type ( vector_type , native_array_element_type . cpp_type_args ( used_in_cpp_sequence = True ) ) if used_as_rvalue_type : return 'const %s&' % vector_template_type return vector_template_type # Simple types base_idl_type = idl_type . base_type if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE : return base_idl_type if base_idl_type in CPP_INT_TYPES : return 'int' if base_idl_type in CPP_UNSIGNED_TYPES : return 'unsigned' if base_idl_type in CPP_SPECIAL_CONVERSION_RULES : return CPP_SPECIAL_CONVERSION_RULES [ base_idl_type ] if base_idl_type in NON_WRAPPER_TYPES : return ( 'PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>' ) % base_idl_type if idl_type . is_string_type : if not raw_type : return 'String' return 'V8StringResource<%s>' % string_mode ( ) if idl_type . is_array_buffer_or_view and raw_type : return idl_type . implemented_as + '*' if idl_type . is_interface_type : implemented_as_class = idl_type . implemented_as if raw_type or ( used_as_rvalue_type and idl_type . is_garbage_collected ) : return implemented_as_class + '*' new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' ptr_type = cpp_ptr_type ( ( 'PassRefPtr' if used_as_rvalue_type else 'RefPtr' ) , new_type , idl_type . gc_type ) return cpp_template_type ( ptr_type , implemented_as_class ) if idl_type . is_dictionary : return base_idl_type if idl_type . is_union_type : # Avoid "AOrNullOrB" for cpp type of (A? or B) because we generate # V8AOrBOrNull to handle nulle for (A? or B), (A or B?) and (A or B)? def member_cpp_name ( idl_type ) : if idl_type . is_nullable : return idl_type . inner_type . name return idl_type . name idl_type_name = "Or" . join ( member_cpp_name ( member ) for member in idl_type . member_types ) return 'const %s&' % idl_type_name if used_as_rvalue_type else idl_type_name # Default, assume native type is a pointer with same type name as idl type return base_idl_type + '*'