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) ⇒ PlatformAvailability

Initialize platform availability from a memory pointer.



738
739
740
741
742
743
744
745
746
# File 'lib/ffi/clang/cursor.rb', line 738

def initialize(memory_pointer)
	pointer = FFI::Pointer.new(memory_pointer)
	super(pointer)
	
	# I'm not sure this is safe.
	# Keep a reference to CXPlatformAvailability itself allocated by MemoryPointer.
	@memory_pointer = memory_pointer
	@platform_availability = Lib::CXPlatformAvailability.new(memory_pointer)
end

Class Method Details

.release(pointer) ⇒ Object

Release the platform availability pointer.



750
751
752
753
# File 'lib/ffi/clang/cursor.rb', line 750

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.



775
776
777
# File 'lib/ffi/clang/cursor.rb', line 775

def deprecated
	@platform_availability[:deprecated]
end

#introducedObject

Get the version where the feature was introduced.



769
770
771
# File 'lib/ffi/clang/cursor.rb', line 769

def introduced
	@platform_availability[:introduced]
end

#messageObject

Get the availability message.



793
794
795
# File 'lib/ffi/clang/cursor.rb', line 793

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

#obsoletedObject

Get the version where the feature was obsoleted.



781
782
783
# File 'lib/ffi/clang/cursor.rb', line 781

def obsoleted
	@platform_availability[:obsoleted]
end

#platformObject

Get the platform name.



757
758
759
# File 'lib/ffi/clang/cursor.rb', line 757

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

#unavailableObject

Check if the feature is unavailable.



787
788
789
# File 'lib/ffi/clang/cursor.rb', line 787

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