FFI::ClangSourceFFIClangPrintingPolicy

class PrintingPolicy

Represents a printing policy that controls how declarations are formatted.

Definitions

def initialize(cursor)

Initialize a printing policy for a cursor.

Signature

parameter cursor FFI::Pointer

The cursor to get the policy from.

Implementation

def initialize(cursor)
	policy = Lib.get_printing_policy(cursor)
	super(policy)
	@cursor = cursor
end

def self.release(pointer)

Release the printing policy pointer.

Signature

parameter pointer FFI::Pointer

The pointer to release.

Implementation

def self.release(pointer)
	Lib.dispose_printing_policy(pointer)
end

def get_property(property)

Get a printing policy property value.

Signature

parameter property Symbol

The property name.

returns Boolean

The property value.

Implementation

def get_property(property)
	result = Lib.printing_policy_get_property(self, property)
	result == 0 ? false : true
end

def set_property(property, value)

Set a printing policy property value.

Signature

parameter property Symbol

The property name.

parameter value Boolean

The property value.

Implementation

def set_property(property, value)
	Lib.printing_policy_set_property(self, property, value ? 1 : 0)
end

def pretty_print

Pretty print the cursor using this policy.

Signature

returns String

The formatted cursor string.

Implementation

def pretty_print
	Lib.extract_string Lib.pretty_print(@cursor, self)
end