Class: Unknownr::Windows::PROPVARIANT

Inherits:
FFI::Union
  • Object
show all
Includes:
AnonymousSupport
Defined in:
lib/unknownr.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AnonymousSupport

#[], #[]=

Class Method Details

.[](t, *v) ⇒ Object



644
# File 'lib/unknownr.rb', line 644

def self.[](t, *v) new.tap { |var| var.send("#{t}=", *v) } end

Instance Method Details

#boolObject



646
# File 'lib/unknownr.rb', line 646

def bool; raise 'Wrong type tag.' unless self[:vt] == VT_BOOL; self[:boolVal] != 0 end

#bool=(bool) ⇒ Object



647
# File 'lib/unknownr.rb', line 647

def bool=(bool) self[:vt] = VT_BOOL; self[:boolVal] = (bool) ? -1 : 0 end

#decimalObject



677
678
679
680
681
# File 'lib/unknownr.rb', line 677

def decimal
	raise 'Wrong type tag.' unless self[:vt] == VT_DECIMAL

	Rational(self[:decVal][:Lo64], 10 ** self[:decVal][:scale]) + self[:decVal][:Hi32]
end

#decimal=(decimal) ⇒ Object



683
# File 'lib/unknownr.rb', line 683

def decimal=(decimal) self[:vt] = VT_DECIMAL; self[:decVal][:Lo64] = decimal end

#intObject



649
# File 'lib/unknownr.rb', line 649

def int; raise 'Wrong type tag.' unless self[:vt] == VT_I4; self[:intVal] end

#int=(int) ⇒ Object



650
# File 'lib/unknownr.rb', line 650

def int=(int) self[:vt] = VT_I4; self[:intVal] = int end

#uintObject



652
# File 'lib/unknownr.rb', line 652

def uint; raise 'Wrong type tag.' unless self[:vt] == VT_UI4; self[:uintVal] end

#uint=(uint) ⇒ Object



653
# File 'lib/unknownr.rb', line 653

def uint=(uint) self[:vt] = VT_UI4; self[:uintVal] = uint end

#unknownObject



655
656
657
658
659
660
661
# File 'lib/unknownr.rb', line 655

def unknown
	raise 'Wrong type tag.' unless self[:vt] == VT_UNKNOWN

	yield Unknown.new(self[:punkVal])
ensure
	Windows.PropVariantClear(self)
end

#unknown=(unknown) ⇒ Object



663
# File 'lib/unknownr.rb', line 663

def unknown=(unknown) self[:vt] = VT_UNKNOWN; self[:punkVal] = unknown.pointer; unknown.AddRef end

#wstringObject



665
# File 'lib/unknownr.rb', line 665

def wstring; raise 'Wrong type tag.' unless self[:vt] == VT_LPWSTR; Windows.WCSTOMBS(self[:pwszVal]) end

#wstring=(string) ⇒ Object



667
668
669
670
671
672
673
674
675
# File 'lib/unknownr.rb', line 667

def wstring=(string)
	self[:vt] = VT_LPWSTR

	FFI::MemoryPointer.new(:pointer) { |p|
		Windows.DetonateHresult(:SHStrDup, string, p)

		self[:pwszVal] = p.read_pointer
	}
end