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



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

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

Instance Method Details

#boolObject



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

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

#bool=(bool) ⇒ Object



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

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

#decimalObject



679
680
681
682
683
# File 'lib/unknownr.rb', line 679

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



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

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

#intObject



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

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

#int=(int) ⇒ Object



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

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

#uintObject



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

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

#uint=(uint) ⇒ Object



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

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

#unknownObject



657
658
659
660
661
662
663
# File 'lib/unknownr.rb', line 657

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

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

#unknown=(unknown) ⇒ Object



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

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

#wstringObject



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

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

#wstring=(string) ⇒ Object



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

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

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

		self[:pwszVal] = p.read_pointer
	}
end