Module: Fzeet::Windows::COM::Interface

Defined in:
lib/fzeet/windows/com/Common.rb

Class Method Summary collapse

Class Method Details

.[](*args) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/fzeet/windows/com/Common.rb', line 101

def self.[](*args)
	spec, iid, *ifaces = args.reverse

	spec.each { |name, signature| signature[0].unshift(:pointer) }

	Class.new(FFI::Struct) {
		const_set(:IID, iid)

		const_set(:VTBL, Class.new(FFI::Struct) {
			const_set(:SPEC, Hash[(ifaces.map { |iface| iface::VTBL::SPEC.to_a } << spec.to_a).flatten(1)])

			layout \
				*self::SPEC.map { |name, signature| [name, callback(*signature)] }.flatten
		})

		layout \
			:lpVtbl, :pointer
	}
end