Module: FFIDB::Symbolic

Includes:
Comparable
Included in:
Enum, Function, Struct, Typedef, Union
Defined in:
lib/ffidb/symbolic.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Integer

Parameters:

Returns:

  • (Integer)


10
11
12
# File 'lib/ffidb/symbolic.rb', line 10

def <=>(other)
  self.name <=> other.name
end

#enum?Boolean

Returns:

  • (Boolean)


44
# File 'lib/ffidb/symbolic.rb', line 44

def enum?() return false end

#function?Boolean

Returns:

  • (Boolean)


56
# File 'lib/ffidb/symbolic.rb', line 56

def function?() return false end

#kindSymbol

Returns:

  • (Symbol)


16
17
18
19
20
21
22
23
24
# File 'lib/ffidb/symbolic.rb', line 16

def kind
  case
    when self.typedef? then :typedef
    when self.enum? then :enum
    when self.struct? then :struct
    when self.union? then :union
    when self.function? then :function
  end
end

#kind_weightInteger

Returns:

  • (Integer)


28
29
30
31
32
33
34
35
36
# File 'lib/ffidb/symbolic.rb', line 28

def kind_weight
  case
    when self.typedef? then 1
    when self.enum? then 2
    when self.struct? then 3
    when self.union? then 4
    when self.function? then 5
  end
end

#struct?Boolean

Returns:

  • (Boolean)


48
# File 'lib/ffidb/symbolic.rb', line 48

def struct?() return false end

#to_yamlString

Returns:

  • (String)


60
61
62
63
64
65
# File 'lib/ffidb/symbolic.rb', line 60

def to_yaml
  h = self.to_h
  h.transform_keys!(&:to_s)
  h.transform_values! { |v| v.is_a?(Hash) ? v.transform_keys!(&:to_s) : v }
  YAML.dump(h).gsub!("---\n", "--- !#{self.kind}\n")
end

#typedef?Boolean

Returns:

  • (Boolean)


40
# File 'lib/ffidb/symbolic.rb', line 40

def typedef?() return false end

#union?Boolean

Returns:

  • (Boolean)


52
# File 'lib/ffidb/symbolic.rb', line 52

def union?() return false end