Class: LLDB::FileSpec
- Inherits:
-
Object
- Object
- LLDB::FileSpec
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/file_spec.rb
Class Method Summary collapse
Instance Method Summary collapse
- #directory ⇒ Object
- #directory=(value) ⇒ Object
- #exists? ⇒ Boolean
- #filename ⇒ Object
- #filename=(value) ⇒ Object
-
#initialize(path = nil, resolve: false, context: nil, pointer: nil) ⇒ FileSpec
constructor
A new instance of FileSpec.
- #path ⇒ Object
- #to_ptr ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(path = nil, resolve: false, context: nil, pointer: nil) ⇒ FileSpec
Returns a new instance of FileSpec.
14 15 16 17 18 19 20 21 22 |
# File 'lib/lldb/file_spec.rb', line 14 def initialize(path = nil, resolve: false, context: nil, pointer: nil) NativeStringArray.validate!(path) if path ptr = pointer || FFIBindings.lldb_file_spec_create(path, resolve ? 1 : 0) initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_file_spec_destroy(released) }, context: context ) end |
Class Method Details
.from_ptr(ptr, context: nil) ⇒ Object
27 28 29 |
# File 'lib/lldb/file_spec.rb', line 27 def self.from_ptr(ptr, context: nil) new(context: context, pointer: ptr) end |
Instance Method Details
#directory ⇒ Object
49 50 51 52 53 |
# File 'lib/lldb/file_spec.rb', line 49 def directory return nil unless valid? FFIBindings.lldb_file_spec_get_directory(@ptr) end |
#directory=(value) ⇒ Object
74 75 76 77 78 |
# File 'lib/lldb/file_spec.rb', line 74 def directory=(value) ensure_open! NativeStringArray.validate!(value) FFIBindings.lldb_file_spec_set_directory(@ptr, value) end |
#exists? ⇒ Boolean
37 38 39 |
# File 'lib/lldb/file_spec.rb', line 37 def exists? valid? && FFIBindings.lldb_file_spec_exists(@ptr) != 0 end |
#filename ⇒ Object
42 43 44 45 46 |
# File 'lib/lldb/file_spec.rb', line 42 def filename return nil unless valid? FFIBindings.lldb_file_spec_get_filename(@ptr) end |
#filename=(value) ⇒ Object
66 67 68 69 70 |
# File 'lib/lldb/file_spec.rb', line 66 def filename=(value) ensure_open! NativeStringArray.validate!(value) FFIBindings.lldb_file_spec_set_filename(@ptr, value) end |
#path ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/lldb/file_spec.rb', line 56 def path return '' unless valid? NativeBuffer.read_c_string do |buffer, length| FFIBindings.lldb_file_spec_get_path(@ptr, buffer, length) end end |
#to_ptr ⇒ Object
86 87 88 |
# File 'lib/lldb/file_spec.rb', line 86 def to_ptr @ptr end |
#to_s ⇒ Object
81 82 83 |
# File 'lib/lldb/file_spec.rb', line 81 def to_s path end |
#valid? ⇒ Boolean
32 33 34 |
# File 'lib/lldb/file_spec.rb', line 32 def valid? !@ptr.null? && FFIBindings.lldb_file_spec_is_valid(@ptr) != 0 end |