Questions about bool or sal_Bool in Any::setValue, makeAny
Matteo Casalin
matteo.casalin at yahoo.com
Mon Nov 17 14:40:20 PST 2014
On 11/17/2014 10:39 PM, Michael Stahl wrote:
> On 16.11.2014 19:57, Matteo Casalin wrote:
>> Hi all,
>> I was converting all sw call-places to Any::setValue that pass
>> sal_Bool to use bool instead. I wonder if this is a good choice or not,
>> is there any guideline?
>
> it looks like the Any has specific support for C++ bool so it should
> work fine.
I confirm that the code compiles fine (on Linux x86_64), so I'll proceed
with these changes.
>
>> Also some of these call places look like:
>>
>> sal_Bool bTrue = sal_True;
>> uno::Any aVal(&bTrue, ::getBooleanCppuType());
>> some_function_call( aVal );
>>
>> or
>>
>> uno::Any aAny;
>> sal_Bool bFalse = sal_False;
>> aTmp.setValue(&bFalse, ::getBooleanCppuType() );
>> some_function_call( aTmp );
>>
>> could these be changed to use makeAny(bool)? Does this hold also if the
>> same Any object is used multiple times (each time calling setValue on it)?
>
> it's much better to use a type-safe method like makeAny() or operator<<=
> and not the Any::setValue()/getValue() methods that operate on unsafe void*.
>
Thank you Michael for the hints.
I will work on a patch that does both bool and makeAny (or <<=) and
submit it to gerrit for a final review.
Matteo
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
More information about the LibreOffice
mailing list