Class: LLDB::FileSpecList
- Inherits:
-
Object
- Object
- LLDB::FileSpecList
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/file_spec_list.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
- #append(file_spec) ⇒ Object
- #append_if_unique(file_spec) ⇒ Object
- #clear ⇒ Object
-
#initialize(context: nil) ⇒ FileSpecList
constructor
A new instance of FileSpecList.
- #size ⇒ Object (also: #length)
- #to_a ⇒ Object
- #to_ptr ⇒ Object
- #valid? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(context: nil) ⇒ FileSpecList
Returns a new instance of FileSpecList.
11 12 13 14 15 16 17 |
# File 'lib/lldb/file_spec_list.rb', line 11 def initialize(context: nil) initialize_native_object( FFIBindings.lldb_file_spec_list_create, release: ->(released) { FFIBindings.lldb_file_spec_list_destroy(released) }, context: context ) end |
Instance Method Details
#[](index) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/lldb/file_spec_list.rb', line 59 def [](index) return nil unless valid? ptr = FFIBindings.lldb_file_spec_list_get_file_spec_at_index(@ptr, index) return nil if ptr.nil? || ptr.null? FileSpec.from_ptr(ptr, context: context) end |
#append(file_spec) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/lldb/file_spec_list.rb', line 35 def append(file_spec) ensure_open! raise ArgumentError, 'file_spec must be a FileSpec' unless file_spec.is_a?(FileSpec) FFIBindings.lldb_file_spec_list_append(@ptr, file_spec.to_ptr) end |
#append_if_unique(file_spec) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/lldb/file_spec_list.rb', line 44 def append_if_unique(file_spec) ensure_open! raise ArgumentError, 'file_spec must be a FileSpec' unless file_spec.is_a?(FileSpec) FFIBindings.lldb_file_spec_list_append_if_unique(@ptr, file_spec.to_ptr) != 0 end |
#clear ⇒ Object
52 53 54 55 |
# File 'lib/lldb/file_spec_list.rb', line 52 def clear ensure_open! FFIBindings.lldb_file_spec_list_clear(@ptr) end |
#size ⇒ Object Also known as: length
25 26 27 28 29 |
# File 'lib/lldb/file_spec_list.rb', line 25 def size return 0 unless valid? FFIBindings.lldb_file_spec_list_get_size(@ptr) end |
#to_a ⇒ Object
69 70 71 |
# File 'lib/lldb/file_spec_list.rb', line 69 def to_a (0...size).map { |index| self[index] }.compact end |
#to_ptr ⇒ Object
74 75 76 |
# File 'lib/lldb/file_spec_list.rb', line 74 def to_ptr @ptr end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/lldb/file_spec_list.rb', line 20 def valid? !@ptr.null? && FFIBindings.lldb_file_spec_list_is_valid(@ptr) != 0 end |