Class: FFI::Clang::CompilationDatabase::CompileCommand

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

Overview

Represents a single compile command.

Instance Method Summary collapse

Constructor Details

#initialize(pointer) ⇒ CompileCommand

Initialize a compile command.



99
100
101
# File 'lib/ffi/clang/compilation_database.rb', line 99

def initialize(pointer)
	@pointer = pointer
end

Instance Method Details

#arg(i) ⇒ Object

Get an argument by index.



118
119
120
# File 'lib/ffi/clang/compilation_database.rb', line 118

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

#argsObject

Get all arguments.



124
125
126
# File 'lib/ffi/clang/compilation_database.rb', line 124

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

#directoryObject

Get the working directory for the command.



105
106
107
# File 'lib/ffi/clang/compilation_database.rb', line 105

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

#mapped_source_content(i) ⇒ Object

Get mapped source content by index.

Raises:

  • (NotImplementedError)


149
150
151
152
# File 'lib/ffi/clang/compilation_database.rb', line 149

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

#mapped_source_path(i) ⇒ Object

Get a mapped source path by index.

Raises:

  • (NotImplementedError)


140
141
142
143
# File 'lib/ffi/clang/compilation_database.rb', line 140

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

#mapped_sourcesObject

Get all mapped sources.



157
158
159
160
161
# File 'lib/ffi/clang/compilation_database.rb', line 157

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

#num_argsObject

Get the number of arguments.



111
112
113
# File 'lib/ffi/clang/compilation_database.rb', line 111

def num_args
	Lib.compile_command_get_num_args(@pointer)
end

#num_mapped_sourcesObject

Get the number of mapped sources.

Raises:

  • (NotImplementedError)


131
132
133
134
# File 'lib/ffi/clang/compilation_database.rb', line 131

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