FFI::ClangSourceFFIClangCursorPlatformAvailability

class PlatformAvailability

Represents platform availability information for a cursor.

Definitions

def initialize(memory_pointer, buffer)

Initialize platform availability from a pointer into the availability buffer.

Signature

parameter memory_pointer FFI::Pointer

Pointer to a CXPlatformAvailability struct.

parameter buffer FFI::MemoryPointer

The original buffer that owns the struct memory.

Implementation

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

def self.release(pointer)

Release the platform availability pointer.

Signature

parameter pointer FFI::Pointer

The pointer to release.

Implementation

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

def platform

Get the platform name.

Signature

returns String

The platform name.

Implementation

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

def introduced

Get the version where the feature was introduced.

Signature

returns Lib::CXVersion

The introduced version.

Implementation

def introduced
	@platform_availability[:introduced]
end

def deprecated

Get the version where the feature was deprecated.

Signature

returns Lib::CXVersion

The deprecated version.

Implementation

def deprecated
	@platform_availability[:deprecated]
end

def obsoleted

Get the version where the feature was obsoleted.

Signature

returns Lib::CXVersion

The obsoleted version.

Implementation

def obsoleted
	@platform_availability[:obsoleted]
end

def unavailable

Check if the feature is unavailable.

Signature

returns Boolean

True if unavailable.

Implementation

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

def message

Get the availability message.

Signature

returns String

The availability message.

Implementation

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