Class: FFI::Clang::File
- Inherits:
-
Pointer
- Object
- Pointer
- FFI::Clang::File
- Defined in:
- lib/ffi/clang/file.rb
Overview
Represents a file in a translation unit.
Instance Attribute Summary collapse
- #The translation unit this file belongs to.(translationunitthisfilebelongsto.) ⇒ Object readonly
-
#translation_unit ⇒ Object
readonly
Returns the value of attribute translation_unit.
Instance Method Summary collapse
-
#device ⇒ Object
Get the device ID of the file.
-
#include_guarded? ⇒ Boolean
Check if the file has include guards.
-
#initialize(pointer, translation_unit) ⇒ File
constructor
Initialize a file with a pointer and translation unit.
-
#inode ⇒ Object
Get the inode number of the file.
-
#modification ⇒ Object
Get the modification time from the unique ID.
-
#name ⇒ Object
Get the file name.
-
#time ⇒ Object
Get the file modification time.
-
#to_s ⇒ Object
Get the file name as a string.
Constructor Details
#initialize(pointer, translation_unit) ⇒ File
Initialize a file with a pointer and translation unit.
19 20 21 22 23 24 25 26 |
# File 'lib/ffi/clang/file.rb', line 19 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
#The translation unit this file belongs to.(translationunitthisfilebelongsto.) ⇒ Object (readonly)
14 |
# File 'lib/ffi/clang/file.rb', line 14 attr_reader :translation_unit |
#translation_unit ⇒ Object (readonly)
Returns the value of attribute translation_unit.
14 15 16 |
# File 'lib/ffi/clang/file.rb', line 14 def translation_unit @translation_unit end |
Instance Method Details
#device ⇒ Object
Get the device ID of the file.
54 55 56 |
# File 'lib/ffi/clang/file.rb', line 54 def device @unique_id[:device] end |
#include_guarded? ⇒ Boolean
Check if the file has include guards.
48 49 50 |
# File 'lib/ffi/clang/file.rb', line 48 def include_guarded? Lib.is_file_multiple_include_guarded(@translation_unit, self) != 0 end |
#inode ⇒ Object
Get the inode number of the file.
60 61 62 |
# File 'lib/ffi/clang/file.rb', line 60 def inode @unique_id[:inode] end |
#modification ⇒ Object
Get the modification time from the unique ID.
66 67 68 |
# File 'lib/ffi/clang/file.rb', line 66 def modification Time.at(@unique_id[:modification]) end |
#name ⇒ Object
Get the file name.
36 37 38 |
# File 'lib/ffi/clang/file.rb', line 36 def name Lib.extract_string Lib.get_file_name(self) end |
#time ⇒ Object
Get the file modification time.
42 43 44 |
# File 'lib/ffi/clang/file.rb', line 42 def time Time.at(Lib.get_file_time(self)) end |
#to_s ⇒ Object
Get the file name as a string.
30 31 32 |
# File 'lib/ffi/clang/file.rb', line 30 def to_s name end |