Class: FFI::Generator::Type::Declaration

Inherits:
Object
  • Object
show all
Defined in:
lib/generator/type.rb

Instance Method Summary collapse

Constructor Details

#initialize(declaration) ⇒ Declaration

Returns a new instance of Declaration.



10
11
12
# File 'lib/generator/type.rb', line 10

def initialize(declaration)
  @full_decl = declaration
end

Instance Method Details

#is_array?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/generator/type.rb', line 22

def is_array?
  @full_decl and @full_decl[ArrayRE]
end

#is_callback?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/generator/type.rb', line 37

def is_callback?
  @full_decl[/^callback/]
end

#is_constant?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/generator/type.rb', line 31

def is_constant?
  @full_decl[/^q\(const\)/]
end

#is_enum?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/generator/type.rb', line 19

def is_enum?
  @full_decl[/^enum/]
end

#is_inline_callback?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/generator/type.rb', line 40

def is_inline_callback?
  @full_decl[/^p.f\(/]
end

#is_native?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/generator/type.rb', line 13

def is_native?
  Generator::TYPES.has_key?(@full_decl)
end

#is_pointer?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/generator/type.rb', line 16

def is_pointer?
  @full_decl[/^p\./] and not is_inline_callback?
end

#is_struct?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/generator/type.rb', line 25

def is_struct?
  @full_decl[/^struct/]
end

#is_union?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/generator/type.rb', line 28

def is_union?
  @full_decl[/^union/]
end

#is_volatile?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/generator/type.rb', line 34

def is_volatile?
  @full_decl[/^q\(volatile\)/]
end