Class: LLDB::Error
- Inherits:
-
Object
- Object
- LLDB::Error
- Defined in:
- lib/lldb/error.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clear ⇒ Object
- #code ⇒ Object (also: #error_code)
- #fail? ⇒ Boolean
-
#initialize(ptr = nil) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object (also: #to_s)
- #raise_if_error!(operation = 'native operation') ⇒ Object
- #set_error(message) ⇒ Object
- #success? ⇒ Boolean
- #to_ptr ⇒ Object
- #type ⇒ Object
- #type_name ⇒ Object
Constructor Details
#initialize(ptr = nil) ⇒ Error
Returns a new instance of Error.
51 52 53 54 |
# File 'lib/lldb/error.rb', line 51 def initialize(ptr = nil) @ptr = ptr || FFIBindings.lldb_error_create ObjectSpace.define_finalizer(self, self.class.release(@ptr)) end |
Class Method Details
.release(ptr) ⇒ Object
58 59 60 |
# File 'lib/lldb/error.rb', line 58 def self.release(ptr) ->(_id) { FFIBindings.lldb_error_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#clear ⇒ Object
97 98 99 |
# File 'lib/lldb/error.rb', line 97 def clear FFIBindings.lldb_error_clear(@ptr) end |
#code ⇒ Object Also known as: error_code
80 81 82 |
# File 'lib/lldb/error.rb', line 80 def code FFIBindings.lldb_error_get_error(@ptr) end |
#fail? ⇒ Boolean
68 69 70 |
# File 'lib/lldb/error.rb', line 68 def fail? FFIBindings.lldb_error_fail(@ptr) != 0 end |
#message ⇒ Object Also known as: to_s
73 74 75 |
# File 'lib/lldb/error.rb', line 73 def FFIBindings.lldb_error_get_cstring(@ptr) || '' end |
#raise_if_error!(operation = 'native operation') ⇒ Object
114 115 116 |
# File 'lib/lldb/error.rb', line 114 def raise_if_error!(operation = 'native operation') raise OperationError.new(operation, self) if fail? end |
#set_error(message) ⇒ Object
103 104 105 |
# File 'lib/lldb/error.rb', line 103 def set_error() FFIBindings.lldb_error_set_error_string(@ptr, ) end |
#success? ⇒ Boolean
63 64 65 |
# File 'lib/lldb/error.rb', line 63 def success? FFIBindings.lldb_error_success(@ptr) != 0 end |
#to_ptr ⇒ Object
108 109 110 |
# File 'lib/lldb/error.rb', line 108 def to_ptr @ptr end |
#type ⇒ Object
87 88 89 |
# File 'lib/lldb/error.rb', line 87 def type FFIBindings.lldb_error_get_type(@ptr) end |