Class: Fzeet::Windows::BSTR

Inherits:
Object
  • Object
show all
Defined in:
lib/fzeet/windows/oleaut/Bstr.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pointer) ⇒ BSTR

Returns a new instance of BSTR.



20
# File 'lib/fzeet/windows/oleaut/Bstr.rb', line 20

def initialize(pointer) @pointer = pointer end

Instance Attribute Details

#pointerObject (readonly)

Returns the value of attribute pointer.



22
23
24
# File 'lib/fzeet/windows/oleaut/Bstr.rb', line 22

def pointer
  @pointer
end

Class Method Details

.[](s) ⇒ Object Also known as: from



6
7
8
9
10
11
12
13
14
# File 'lib/fzeet/windows/oleaut/Bstr.rb', line 6

def self.[](s)
	bstr = new(Windows.SysAllocString("#{s}\0".encode('utf-16le')))

	if block_given?
		yield bstr; bstr.dispose; return nil
	end

	bstr
end

Instance Method Details

#freeObject Also known as: dispose



24
# File 'lib/fzeet/windows/oleaut/Bstr.rb', line 24

def free; Windows.SysFreeString(@pointer) end

#lengthObject Also known as: size



27
# File 'lib/fzeet/windows/oleaut/Bstr.rb', line 27

def length; Windows.SysStringLen(@pointer) end

#multibyteObject



30
# File 'lib/fzeet/windows/oleaut/Bstr.rb', line 30

def multibyte; Windows.WCSTOMBS(@pointer) end