Class: FFI::Clang::Index
- Inherits:
-
AutoPointer
- Object
- AutoPointer
- FFI::Clang::Index
- Defined in:
- lib/ffi/clang/index.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_translation_unit(ast_filename) ⇒ Object
-
#initialize(exclude_declarations = true, display_diagnostics = false) ⇒ Index
constructor
A new instance of Index.
- #parse_translation_unit(source_file, command_line_args = nil, unsaved = [], opts = {}) ⇒ Object
Constructor Details
#initialize(exclude_declarations = true, display_diagnostics = false) ⇒ Index
Returns a new instance of Index.
28 29 30 |
# File 'lib/ffi/clang/index.rb', line 28 def initialize(exclude_declarations = true, display_diagnostics = false) super Lib.create_index(exclude_declarations ? 1 : 0, display_diagnostics ? 1 : 0) end |
Class Method Details
.release(pointer) ⇒ Object
32 33 34 |
# File 'lib/ffi/clang/index.rb', line 32 def self.release(pointer) Lib.dispose_index(pointer) end |
Instance Method Details
#create_translation_unit(ast_filename) ⇒ Object
47 48 49 50 51 |
# File 'lib/ffi/clang/index.rb', line 47 def create_translation_unit(ast_filename) translation_unit_pointer = Lib.create_translation_unit(self, ast_filename) raise Error, "error parsing #{ast_filename.inspect}" if translation_unit_pointer.null? TranslationUnit.new translation_unit_pointer, self end |
#parse_translation_unit(source_file, command_line_args = nil, unsaved = [], opts = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ffi/clang/index.rb', line 36 def parse_translation_unit(source_file, command_line_args = nil, unsaved = [], opts = {}) command_line_args = Array(command_line_args) unsaved_files = UnsavedFile.unsaved_pointer_from(unsaved) translation_unit_pointer = Lib.parse_translation_unit(self, source_file, args_pointer_from(command_line_args), command_line_args.size, unsaved_files, unsaved.length, (opts)) raise Error, "error parsing #{source_file.inspect}" if translation_unit_pointer.null? TranslationUnit.new translation_unit_pointer, self end |