class CompileCommands
Represents a collection of compile commands.
Definitions
def initialize(pointer, database)
Initialize compile commands.
Signature
-
parameter
pointerFFI::Pointer The commands pointer.
-
parameter
databaseCompilationDatabase The parent database.
Implementation
def initialize(pointer, database)
super pointer
@database = database
end
def self.release(pointer)
Release the compile commands pointer.
Signature
-
parameter
pointerFFI::Pointer The pointer to release.
Implementation
def self.release(pointer)
Lib.compile_commands_dispose(pointer)
end
def size
Get the number of compile commands.
Signature
-
returns
Integer The number of commands.
Implementation
def size
Lib.compile_commands_get_size(self)
end
def command(i)
Get a compile command by index.
Signature
-
parameter
iInteger The command index.
-
returns
CompileCommand The compile command.
Implementation
def command(i)
CompileCommand.new Lib.compile_commands_get_command(self, i)
end
def commands
Get all compile commands.
Signature
-
returns
Array(CompileCommand) Array of compile commands.
Implementation
def commands
size.times.map {|i| command(i)}
end
def each(&block)
Iterate over each compile command.
Signature
-
yields
{|command| ...} Each compile command.
-
parameter
commandCompileCommand The compile command.
-
parameter
Implementation
def each(&block)
size.times.map do |i|
block.call(command(i))
end
end