Class: FFI::Clang::Cursor::PlatformAvailability

Inherits:
AutoPointer
  • Object
show all
Defined in:
lib/ffi/clang/cursor.rb

Overview

Represents platform availability information for a cursor.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(memory_pointer, buffer) ⇒ PlatformAvailability

Initialize platform availability from a pointer into the availability buffer.



1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
# File 'lib/ffi/clang/cursor.rb', line 1052

def initialize(memory_pointer, buffer)
	pointer = FFI::Pointer.new(memory_pointer)
	super(pointer)
	
	# Keep a reference to the buffer so it is not garbage collected
	# while this object is alive. The buffer owns the struct memory;
	# AutoPointer#release only disposes the strings within the struct
	# via clang_disposeCXPlatformAvailability.
	@buffer = buffer
	@platform_availability = Lib::CXPlatformAvailability.new(memory_pointer)
end

Class Method Details

.release(pointer) ⇒ Object

Release the platform availability pointer.



1066
1067
1068
1069
# File 'lib/ffi/clang/cursor.rb', line 1066

def self.release(pointer)
	# Memory allocated by get_cursor_platform_availability is managed by AutoPointer.
	Lib.dispose_platform_availability(Lib::CXPlatformAvailability.new(pointer))
end

Instance Method Details

#deprecatedObject

Get the version where the feature was deprecated.



1085
1086
1087
# File 'lib/ffi/clang/cursor.rb', line 1085

def deprecated
	@platform_availability[:deprecated]
end

#introducedObject

Get the version where the feature was introduced.



1079
1080
1081
# File 'lib/ffi/clang/cursor.rb', line 1079

def introduced
	@platform_availability[:introduced]
end

#messageObject

Get the availability message.



1103
1104
1105
# File 'lib/ffi/clang/cursor.rb', line 1103

def message
	Lib.get_string @platform_availability[:message]
end

#obsoletedObject

Get the version where the feature was obsoleted.



1091
1092
1093
# File 'lib/ffi/clang/cursor.rb', line 1091

def obsoleted
	@platform_availability[:obsoleted]
end

#platformObject

Get the platform name.



1073
1074
1075
# File 'lib/ffi/clang/cursor.rb', line 1073

def platform
	Lib.get_string @platform_availability[:platform]
end

#unavailableObject

Check if the feature is unavailable.



1097
1098
1099
# File 'lib/ffi/clang/cursor.rb', line 1097

def unavailable
	@platform_availability[:unavailable] != 0
end