Class: FFI::Clang::Diagnostic
- Inherits:
-
AutoPointer
- Object
- AutoPointer
- FFI::Clang::Diagnostic
- Defined in:
- lib/ffi/clang/diagnostic.rb
Class Method Summary collapse
Instance Method Summary collapse
- #category ⇒ Object
- #category_id ⇒ Object
- #children ⇒ Object
- #disable_option ⇒ Object
- #enable_option ⇒ Object
- #fixits ⇒ Object
- #format(opts = {}) ⇒ Object
-
#initialize(translation_unit, pointer) ⇒ Diagnostic
constructor
A new instance of Diagnostic.
- #inspect ⇒ Object
- #location ⇒ Object
- #ranges ⇒ Object
- #severity ⇒ Object
- #spelling ⇒ Object
Constructor Details
#initialize(translation_unit, pointer) ⇒ Diagnostic
Returns a new instance of Diagnostic.
33 34 35 36 37 |
# File 'lib/ffi/clang/diagnostic.rb', line 33 def initialize(translation_unit, pointer) super pointer @translation_unit = translation_unit end |
Class Method Details
.default_display_opts ⇒ Object
29 30 31 |
# File 'lib/ffi/clang/diagnostic.rb', line 29 def self.default_display_opts Lib.opts_from Lib::DiagnosticDisplayOptions, Lib. end |
.release(pointer) ⇒ Object
39 40 41 |
# File 'lib/ffi/clang/diagnostic.rb', line 39 def self.release(pointer) Lib.dispose_diagnostic(pointer) end |
Instance Method Details
#category ⇒ Object
94 95 96 |
# File 'lib/ffi/clang/diagnostic.rb', line 94 def category Lib.extract_string Lib.get_diagnostic_category_text(self) end |
#category_id ⇒ Object
98 99 100 |
# File 'lib/ffi/clang/diagnostic.rb', line 98 def category_id Lib.get_diagnostic_category(self) end |
#children ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/ffi/clang/diagnostic.rb', line 76 def children diagnostic_set = Lib.get_child_diagnostics(self) num_diagnostics = Lib.get_num_diagnostics_in_set(diagnostic_set) num_diagnostics.times.map { |i| Diagnostic.new(@translation_unit, Lib.get_diagnostic_in_set(diagnostic_set, i)) } end |
#disable_option ⇒ Object
88 89 90 91 92 |
# File 'lib/ffi/clang/diagnostic.rb', line 88 def disable_option ptr = MemoryPointer.new Lib::CXString Lib.get_diagnostic_option(self, ptr) Lib.extract_string ptr end |
#enable_option ⇒ Object
84 85 86 |
# File 'lib/ffi/clang/diagnostic.rb', line 84 def enable_option Lib.extract_string Lib.get_diagnostic_option(self, nil) end |
#fixits ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/ffi/clang/diagnostic.rb', line 61 def fixits n = Lib.get_diagnostic_num_fix_its(self) n.times.map { |i| ptr = MemoryPointer.new Lib::CXSourceRange replace_text = Lib.extract_string(Lib.get_diagnostic_fix_it(self, i, ptr)) {text: replace_text, range: SourceRange.new(ptr)} } end |
#format(opts = {}) ⇒ Object
43 44 45 46 |
# File 'lib/ffi/clang/diagnostic.rb', line 43 def format(opts = {}) cxstring = Lib.format_diagnostic(self, display_opts(opts)) Lib.extract_string cxstring end |
#inspect ⇒ Object
102 103 104 |
# File 'lib/ffi/clang/diagnostic.rb', line 102 def inspect "#{self.location}: #{self.format}" end |
#location ⇒ Object
56 57 58 59 |
# File 'lib/ffi/clang/diagnostic.rb', line 56 def location sl = Lib.get_diagnostic_location(self) ExpansionLocation.new sl end |
#ranges ⇒ Object
70 71 72 73 74 |
# File 'lib/ffi/clang/diagnostic.rb', line 70 def ranges n = Lib.get_diagnostic_num_ranges(self) n.times.map {|i| SourceRange.new Lib.get_diagnostic_range(self, i)} end |
#severity ⇒ Object
48 49 50 |
# File 'lib/ffi/clang/diagnostic.rb', line 48 def severity Lib.get_diagnostic_severity self end |