Sha256: 1319dacf2f7ac8416c8a08ad20d0ce3671a9ea4a736f0488f079a7b1493beb24

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2024, by Charlie Savage.
# Copyright, 2024, by Samuel Williams.

require_relative 'lib/printing_policy'

module FFI
	module Clang
		class PrintingPolicy < AutoPointer
			def initialize(cursor)
        policy = Lib.get_printing_policy(cursor)
				super(policy)
        @cursor = cursor
			end

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffi-clang-0.13.0 lib/ffi/clang/printing_policy.rb
ffi-clang-0.12.0 lib/ffi/clang/printing_policy.rb
ffi-clang-0.11.0 lib/ffi/clang/printing_policy.rb
ffi-clang-0.10.0 lib/ffi/clang/printing_policy.rb
ffi-clang-0.9.0 lib/ffi/clang/printing_policy.rb