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.



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

def initialize(pointer)
	@pointer = pointer
end

Instance Method Details

#arg(i) ⇒ Object

Get an argument by index.



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

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

#argsObject

Get all arguments.



136
137
138
# File 'lib/ffi/clang/compilation_database.rb', line 136

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

#directoryObject

Get the working directory for the command.



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

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

#filenameObject

Get the filename associated with the command.



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

def filename
	Lib.extract_string Lib.compile_command_get_filename(@pointer)
end

#mapped_source_content(i) ⇒ Object

Get mapped source content by index.



156
157
158
# File 'lib/ffi/clang/compilation_database.rb', line 156

def mapped_source_content(i)
	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.



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

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

#mapped_sourcesObject

Get all mapped sources.



162
163
164
165
166
# File 'lib/ffi/clang/compilation_database.rb', line 162

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.



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

def num_args
	Lib.compile_command_get_num_args(@pointer)
end

#num_mapped_sourcesObject

Get the number of mapped sources.



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

def num_mapped_sources
	Lib.compile_command_get_num_mapped_sources(@pointer)
end