Class: MilkTea::Types::StringView

Inherits:
Base
  • Object
show all
Defined in:
lib/milk_tea/core/types/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#accept, #bitwise?, #boolean?, #children, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?

Constructor Details

#initializeStringView

Returns a new instance of StringView.



557
558
559
560
561
562
563
564
565
# File 'lib/milk_tea/core/types/types.rb', line 557

def initialize
  @name = "str"
  @module_name = nil
  @fields = {
    "data" => GenericInstance.new("ptr", [Primitive.new("char")]),
    "len" => Primitive.new("ptr_uint"),
  }.freeze
  freeze
end

Instance Attribute Details

#module_nameObject (readonly)

Returns the value of attribute module_name.



555
556
557
# File 'lib/milk_tea/core/types/types.rb', line 555

def module_name
  @module_name
end

#nameObject (readonly)

Returns the value of attribute name.



555
556
557
# File 'lib/milk_tea/core/types/types.rb', line 555

def name
  @name
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


567
568
569
# File 'lib/milk_tea/core/types/types.rb', line 567

def eql?(other)
  other.is_a?(StringView)
end

#field(name) ⇒ Object



581
582
583
# File 'lib/milk_tea/core/types/types.rb', line 581

def field(name)
  @fields[name]
end

#fieldsObject



577
578
579
# File 'lib/milk_tea/core/types/types.rb', line 577

def fields
  @fields
end

#hashObject



573
574
575
# File 'lib/milk_tea/core/types/types.rb', line 573

def hash
  self.class.hash
end

#to_sObject



585
586
587
# File 'lib/milk_tea/core/types/types.rb', line 585

def to_s
  "str"
end