Class: FFI::Clang::File

Inherits:
Pointer
  • Object
show all
Defined in:
lib/ffi/clang/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pointer, translation_unit) ⇒ File

Returns a new instance of File.



14
15
16
17
18
19
20
21
# File 'lib/ffi/clang/file.rb', line 14

def initialize(pointer, translation_unit)
	super pointer
	@translation_unit = translation_unit

	pointer = MemoryPointer.new(Lib::CXFileUniqueID)
	Lib.get_file_unique_id(self, pointer)
	@unique_id = Lib::CXFileUniqueID.new(pointer)
end

Instance Attribute Details

#translation_unitObject (readonly)

Returns the value of attribute translation_unit.



12
13
14
# File 'lib/ffi/clang/file.rb', line 12

def translation_unit
  @translation_unit
end

Instance Method Details

#deviceObject



39
40
41
# File 'lib/ffi/clang/file.rb', line 39

def device
	@unique_id[:device]
end

#include_guarded?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/ffi/clang/file.rb', line 35

def include_guarded?
	Lib.is_file_multiple_include_guarded(@translation_unit, self) != 0
end

#inodeObject



43
44
45
# File 'lib/ffi/clang/file.rb', line 43

def inode
	@unique_id[:inode]
end

#modificationObject



47
48
49
# File 'lib/ffi/clang/file.rb', line 47

def modification
	Time.at(@unique_id[:modification])
end

#nameObject



27
28
29
# File 'lib/ffi/clang/file.rb', line 27

def name
	Lib.extract_string Lib.get_file_name(self)
end

#timeObject



31
32
33
# File 'lib/ffi/clang/file.rb', line 31

def time
	Time.at(Lib.get_file_time(self))
end

#to_sObject



23
24
25
# File 'lib/ffi/clang/file.rb', line 23

def to_s
	name
end