Class: AutoC::STD::Primitive

Inherits:
Primitive show all
Includes:
Entity
Defined in:
lib/autoc/std.rb

Overview

Base class for a more elaborate primitive type directly includable into the module as a dependency

Direct Known Subclasses

Complex, CompositeValue

Constant Summary collapse

@@types =
::Set.new

Constants included from Entity

Entity::ReferenceSet

Instance Attribute Summary collapse

Attributes inherited from Type

#signature

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Entity

#<=>, #complexity, #dependencies, #forward_declarations, #implementation, #interface, #position, #references, #total_dependencies, #total_references

Methods inherited from Primitive

#compare, #copy, #custom_create, #default_create, #equal, #hash_code

Methods inherited from Type

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

Constructor Details

#initialize(type, matcher: Regexp.new("^#{type}$"), header: nil) ⇒ Primitive

Returns a new instance of Primitive.



43
44
45
46
47
48
# File 'lib/autoc/std.rb', line 43

def initialize(type, matcher: Regexp.new("^#{type}$"), header: nil)
  super(type)
  @matcher = matcher
  dependencies << header unless header.nil?
  @@types << self
end

Instance Attribute Details

#matcherObject (readonly)

Returns the value of attribute matcher.



41
42
43
# File 'lib/autoc/std.rb', line 41

def matcher
  @matcher
end

Class Method Details

.adopt(x) ⇒ Object



36
37
38
39
# File 'lib/autoc/std.rb', line 36

def self.adopt(x)
  @@types.each { |t| return t unless (t.matcher =~ x).nil? }
  Primitive.new(x)
end

Instance Method Details

#const_lvalueObject



58
# File 'lib/autoc/std.rb', line 58

def const_lvalue = @clv ||= AutoC::Value.new(self, constant: true, reference: true)

#const_rvalueObject



56
# File 'lib/autoc/std.rb', line 56

def const_rvalue = @crv ||= AutoC::Value.new(self, constant: true)

#lvalueObject



54
# File 'lib/autoc/std.rb', line 54

def lvalue = @lv ||= AutoC::Value.new(self, reference: true)

#rvalueObject



52
# File 'lib/autoc/std.rb', line 52

def rvalue = @rv ||= AutoC::Value.new(self)

#to_valueObject



50
# File 'lib/autoc/std.rb', line 50

def to_value = rvalue