FFI::ClangSourceFFIClangCompilationDatabaseCompileCommand

class CompileCommand

Represents a single compile command.

Definitions

def initialize(pointer)

Initialize a compile command.

Signature

parameter pointer FFI::Pointer

The command pointer.

Implementation

def initialize(pointer)
	@pointer = pointer
end

def directory

Get the working directory for the command.

Signature

returns String

The directory path.

Implementation

def directory
	Lib.extract_string Lib.compile_command_get_directory(@pointer)
end

def num_args

Get the number of arguments.

Signature

returns Integer

The number of arguments.

Implementation

def num_args
	Lib.compile_command_get_num_args(@pointer)
end

def arg(i)

Get an argument by index.

Signature

parameter i Integer

The argument index.

returns String

The argument.

Implementation

def arg(i)
	Lib.extract_string Lib.compile_command_get_arg(@pointer, i)
end

def args

Get all arguments.

Signature

returns Array(String)

Array of arguments.

Implementation

def args
	num_args.times.map {|i| arg(i)}
end

def num_mapped_sources

Get the number of mapped sources.

Signature

returns Integer

The number of mapped sources.

raises NotImplementedError

This method is not yet implemented.

Implementation

def num_mapped_sources
	raise NotImplementedError
	# Lib.compile_command_get_num_mapped_sources(@pointer)
end

def mapped_source_path(i)

Get a mapped source path by index.

Signature

parameter i Integer

The source index.

returns String

The mapped source path.

raises NotImplementedError

This method is not yet implemented.

Implementation

def mapped_source_path(i)
	raise NotImplementedError
	# Lib.extract_string Lib.compile_command_get_mapped_source_path(@pointer, i)
end

def mapped_source_content(i)

Get mapped source content by index.

Signature

parameter i Integer

The source index.

returns String

The mapped source content.

raises NotImplementedError

This method is not yet implemented.

Implementation

def mapped_source_content(i)
	raise NotImplementedError
	# Lib.extract_string Lib.compile_command_get_mapped_source_content(@pointer, i)
end

def mapped_sources

Get all mapped sources.

Signature

returns Array(Hash)

Array of hashes with :path and :content keys.

raises NotImplementedError

This method is not yet implemented.

Implementation

def mapped_sources
	num_mapped_sources.times.map {|i|
		{path: mapped_source_path(i), content: mapped_source_content(i)}
	}
end