FFI::ClangSourceFFIClangCompilationDatabaseCompileCommands

class CompileCommands

Represents a collection of compile commands.

Definitions

def initialize(pointer, database)

Initialize compile commands.

Signature

parameter pointer FFI::Pointer

The commands pointer.

parameter database CompilationDatabase

The parent database.

Implementation

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

def self.release(pointer)

Release the compile commands pointer.

Signature

parameter pointer FFI::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 i Integer

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 command CompileCommand

The compile command.

Implementation

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