Class: FFI::Clang::TranslationUnit::ResourceUsage
- Inherits:
-
AutoPointer
- Object
- AutoPointer
- FFI::Clang::TranslationUnit::ResourceUsage
- Defined in:
- lib/ffi/clang/translation_unit.rb
Class Method Summary collapse
Instance Method Summary collapse
- #entries ⇒ Object
-
#initialize(resource_usage) ⇒ ResourceUsage
constructor
A new instance of ResourceUsage.
Constructor Details
#initialize(resource_usage) ⇒ ResourceUsage
Returns a new instance of ResourceUsage.
131 132 133 134 135 136 137 |
# File 'lib/ffi/clang/translation_unit.rb', line 131 def initialize(resource_usage) # CXResourceUsage is returned by value and should be freed explicitly. # Get FFI::pointer of the data so that the data is handled by AutoPointer. pointer = FFI::Pointer.new(resource_usage.to_ptr) super(pointer) @resource_usage = resource_usage end |
Class Method Details
.name(kind) ⇒ Object
144 145 146 |
# File 'lib/ffi/clang/translation_unit.rb', line 144 def self.name(kind) Lib.resource_usage_name(kind) end |
.release(pointer) ⇒ Object
139 140 141 142 |
# File 'lib/ffi/clang/translation_unit.rb', line 139 def self.release(pointer) # clang_disposeCXTUResourceUsage requires value type, so create it by pointer Lib.dispose_resource_usage(Lib::CXTUResourceUsage.new(pointer)) end |
Instance Method Details
#entries ⇒ Object
148 149 150 151 152 153 154 155 156 |
# File 'lib/ffi/clang/translation_unit.rb', line 148 def entries ary = [] ptr = @resource_usage[:entries] @resource_usage[:numEntries].times { ary << Lib::CXTUResourceUsageEntry.new(ptr) ptr += Lib::CXTUResourceUsageEntry.size } ary end |