List Info

Thread: Mapping of the UNO type "hyper" in StarBasic




Mapping of the UNO type "hyper" in StarBasic
user name
2006-06-27 10:51:09
Hi Jürgen,

> it seems that we have to find a better solution for
hyper in Basic 
> because hyper is a valid type in our API and in fact of
this we should 
> extend the typeset of Basic at least to support all the
simple base 
> types of our API.

> Andreas, what do you think? What would be the best
solution to support 
> hyper in Basic?

You're right, but after my fix of i66765 the only problem I
still see is how hyper/int64 can be declared and how the
cor-
responding literals can be handled (i66770).

Bernard's workaround (see below) is not even necessary
after
the fix of i66765 as the hyper comes from UNO and so has not
to be declared explicitely.

sub TestHyper
	dim oUcb as object, oFile as object
	dim hx as variant
	
	oUcb =
createUnoService("com.sun.star.ucb.SimpleFileAccess&q
uot;)
	oFile = oUcb.OpenFileReadWrite(convertToURL( _
		"D:\temp\OOo_2.0.3_060623_Win32Intel_install.exe&
quot;))
		' Size: 96.444.912 bytes
	hx = oFile.getLength
	print hx
	
	hx = hx - 20000000  ' compute a related position
	print hx
	oFile.seek(hx)
	print oFile.getPosition
	
	oFile.closeInput
end sub

Besides this the values do not extend the long range anyway,
so long could be used without problems here (after the fix).

Regards

Andreas


>> I found a solution to this example. Tested on a
50Mbytes file.
>>
>> dim oUcb as object, oFile as object, oInputStream
as object
>> dim hx as variant, hxb as variant, p as variant
>>
>> oUcb =
createUnoService("com.sun.star.ucb.SimpleFileAccess&q
uot;)
>> oFile =
oUcb.OpenFileReadWrite(convertToURL("D:\Music\Haende
l235.wav"))
>> oInputStream =
createUnoService("com.sun.star.io.DataInputStream&quo
t;)
>> oInputStream.setInputStream(oFile.getInputStream())
>> hx = oFile.getLength
>> hxb = CLng(hx)  ' convert to a usable Basic type
>> print hxb
>> hxb = hxb -4879123  ' compute a related position
>> print hxb
>> oFile.seek(CreateUnoValue("hyper", hxb)
>> p = oFile.getPosition
>> print CLng(p)  ' confirmation
>> oInputStream.closeInput
>>
>>
>>    Bernard
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
>> For additional commands, e-mail: dev-helpapi.openoffice.org
>>
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
> For additional commands, e-mail: dev-helpapi.openoffice.org
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )