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.



28
29
30
31
32
33
34
35
# File 'lib/ffi/clang/file.rb', line 28

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.



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

def translation_unit
  @translation_unit
end

Instance Method Details

#deviceObject



53
54
55
# File 'lib/ffi/clang/file.rb', line 53

def device
	@unique_id[:device]
end

#include_guarded?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/ffi/clang/file.rb', line 49

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

#inodeObject



57
58
59
# File 'lib/ffi/clang/file.rb', line 57

def inode
	@unique_id[:inode]
end

#modificationObject



61
62
63
# File 'lib/ffi/clang/file.rb', line 61

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

#nameObject



41
42
43
# File 'lib/ffi/clang/file.rb', line 41

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

#timeObject



45
46
47
# File 'lib/ffi/clang/file.rb', line 45

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

#to_sObject



37
38
39
# File 'lib/ffi/clang/file.rb', line 37

def to_s
	name
end