Class: LLDB::CommandReturnObject
- Inherits:
-
Object
- Object
- LLDB::CommandReturnObject
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/command_return_object.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clear ⇒ Object
- #error ⇒ Object
- #has_result? ⇒ Boolean
-
#initialize(ptr, context: nil) ⇒ CommandReturnObject
constructor
A new instance of CommandReturnObject.
- #output ⇒ Object
- #status ⇒ Object
- #succeeded? ⇒ Boolean
- #to_ptr ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(ptr, context: nil) ⇒ CommandReturnObject
Returns a new instance of CommandReturnObject.
18 19 20 21 22 23 24 |
# File 'lib/lldb/command_return_object.rb', line 18 def initialize(ptr, context: nil) initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_command_return_object_destroy(released) }, context: context ) end |
Class Method Details
.create(context: nil) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/lldb/command_return_object.rb', line 9 def self.create(context: nil) ptr = FFIBindings.lldb_command_return_object_create raise LLDBError, 'Failed to create command return object' if ptr.nil? || ptr.null? new(ptr, context: context) end |
.release(ptr) ⇒ Object
28 29 30 |
# File 'lib/lldb/command_return_object.rb', line 28 def self.release(ptr) ->(_id) { FFIBindings.lldb_command_return_object_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#clear ⇒ Object
74 75 76 77 78 |
# File 'lib/lldb/command_return_object.rb', line 74 def clear raise InvalidObjectError, 'CommandReturnObject is not valid' unless valid? FFIBindings.lldb_command_return_object_clear(@ptr) end |
#error ⇒ Object
45 46 47 48 49 |
# File 'lib/lldb/command_return_object.rb', line 45 def error return nil unless valid? FFIBindings.lldb_command_return_object_get_error(@ptr) end |
#has_result? ⇒ Boolean
67 68 69 70 71 |
# File 'lib/lldb/command_return_object.rb', line 67 def has_result? return false unless valid? FFIBindings.lldb_command_return_object_has_result(@ptr) != 0 end |
#output ⇒ Object
38 39 40 41 42 |
# File 'lib/lldb/command_return_object.rb', line 38 def output return nil unless valid? FFIBindings.lldb_command_return_object_get_output(@ptr) end |
#status ⇒ Object
53 54 55 56 57 |
# File 'lib/lldb/command_return_object.rb', line 53 def status return ReturnStatus::INVALID unless valid? FFIBindings.lldb_command_return_object_get_status(@ptr) end |
#succeeded? ⇒ Boolean
60 61 62 63 64 |
# File 'lib/lldb/command_return_object.rb', line 60 def succeeded? return false unless valid? FFIBindings.lldb_command_return_object_succeeded(@ptr) != 0 end |
#to_ptr ⇒ Object
86 87 88 |
# File 'lib/lldb/command_return_object.rb', line 86 def to_ptr @ptr end |
#to_s ⇒ Object
81 82 83 |
# File 'lib/lldb/command_return_object.rb', line 81 def to_s succeeded? ? (output || '') : (error || '') end |
#valid? ⇒ Boolean
33 34 35 |
# File 'lib/lldb/command_return_object.rb', line 33 def valid? !@ptr.null? && FFIBindings.lldb_command_return_object_is_valid(@ptr) != 0 end |