Class: FFI::Clang::UnsavedFile
- Inherits:
-
Object
- Object
- FFI::Clang::UnsavedFile
- Defined in:
- lib/ffi/clang/unsaved_file.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#filename ⇒ Object
Returns the value of attribute filename.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename, contents) ⇒ UnsavedFile
constructor
A new instance of UnsavedFile.
Constructor Details
#initialize(filename, contents) ⇒ UnsavedFile
Returns a new instance of UnsavedFile.
11 12 13 14 |
# File 'lib/ffi/clang/unsaved_file.rb', line 11 def initialize(filename, contents) @filename = filename @contents = contents end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
16 17 18 |
# File 'lib/ffi/clang/unsaved_file.rb', line 16 def contents @contents end |
#filename ⇒ Object
Returns the value of attribute filename.
16 17 18 |
# File 'lib/ffi/clang/unsaved_file.rb', line 16 def filename @filename end |
Class Method Details
.unsaved_pointer_from(unsaved) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ffi/clang/unsaved_file.rb', line 19 def self.unsaved_pointer_from(unsaved) return nil if unsaved.length == 0 vec = MemoryPointer.new(Lib::CXUnsavedFile, unsaved.length) unsaved.each_with_index do |file, i| uf = Lib::CXUnsavedFile.new(vec + i * Lib::CXUnsavedFile.size) uf[:filename] = MemoryPointer.from_string(file.filename) uf[:contents] = MemoryPointer.from_string(file.contents) uf[:length] = file.contents.length end vec end |