Class: FFI::Clang::CompilationDatabase::CompileCommands

Inherits:
AutoPointer
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ffi/clang/compilation_database.rb

Overview

Represents a collection of compile commands.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pointer, database) ⇒ CompileCommands

Initialize compile commands.



55
56
57
58
# File 'lib/ffi/clang/compilation_database.rb', line 55

def initialize(pointer, database)
  super pointer
  @database = database
end

Class Method Details

.release(pointer) ⇒ Object

Release the compile commands pointer.



62
63
64
# File 'lib/ffi/clang/compilation_database.rb', line 62

def self.release(pointer)
  Lib.compile_commands_dispose(pointer)
end

Instance Method Details

#command(i) ⇒ Object

Get a compile command by index.



75
76
77
# File 'lib/ffi/clang/compilation_database.rb', line 75

def command(i)
  CompileCommand.new Lib.compile_commands_get_command(self, i)
end

#commandsObject

Get all compile commands.



81
82
83
# File 'lib/ffi/clang/compilation_database.rb', line 81

def commands
  size.times.map {|i| command(i)}
end

#each(&block) ⇒ Object

Iterate over each compile command.



88
89
90
91
92
# File 'lib/ffi/clang/compilation_database.rb', line 88

def each(&block)
  size.times.map do |i|
    block.call(command(i))
  end
end

#sizeObject

Get the number of compile commands.



68
69
70
# File 'lib/ffi/clang/compilation_database.rb', line 68

def size
  Lib.compile_commands_get_size(self)
end