Class: AutoC::Primitive

Inherits:
Type
  • Object
show all
Defined in:
lib/autoc/primitive.rb

Direct Known Subclasses

STD::Primitive

Instance Attribute Summary

Attributes inherited from Type

#signature

Instance Method Summary collapse

Methods inherited from Type

abstract, #comparable?, #constructible?, #copyable?, #custom_constructible?, #default_constructible?, #destroy, #destructible?, #hashable?, #initialize, #inspect, #orderable?, #to_s, #to_type

Constructor Details

This class inherits a constructor from AutoC::Type

Instance Method Details

#compareObject



20
# File 'lib/autoc/primitive.rb', line 20

def compare = @compare ||= -> (lt, rt) { "(#{lt} == #{rt} ? 0 : (#{lt} > #{rt} ? +1 : -1))" }

#copyObject



16
# File 'lib/autoc/primitive.rb', line 16

def copy = @copy ||= -> (target, source) { "#{target} = #{source}" }

#custom_createObject



14
# File 'lib/autoc/primitive.rb', line 14

def custom_create = @custom_create ||= -> (target, source) { copy.(target, source) }

#default_createObject



12
# File 'lib/autoc/primitive.rb', line 12

def default_create = @default_create ||= -> (target) { copy.(target, 0) }

#equalObject



18
# File 'lib/autoc/primitive.rb', line 18

def equal = @equal ||= -> (lt, rt) { "#{lt} == #{rt}" }

#hash_codeObject



22
# File 'lib/autoc/primitive.rb', line 22

def hash_code = @hash_code ||= -> (target) { "(size_t)(#{target})" }