[Libreoffice] weird code, please advise...

Stephan Bergmann sbergman at redhat.com
Wed Dec 14 01:09:07 PST 2011


On 12/13/2011 07:09 PM, Michael Meeks wrote:
> On Tue, 2011-12-13 at 16:02 -0200, Olivier Hallot wrote:
>> I am stumbling on the following piece of code
>>
>>              if (nodepath.getLength() != 0 || !(value>>= nodepath) || nodepath.getLength() == 0)
> ...
>> in configmgr/source/configurationprovider.cxx:204,
>> and nodepath is an rtl::OUString
>>
>> is this TRUE always, or did I missed something?
>
> 	What you're missing is this mid-mashing operator overloading; whereby
> >>= actually assigns a string to nodepath ;-) so what it says to me is:
> if the length>  0 and we successfully assign it to something else from
> 'value' and the result is non zero - then don't fail ;-)

Yeah, what it checks is that neither is nodepath already non-empty 
(i.e., multiple "nodepath" arguments passed in), nor does extracting the 
nodepath string from the value Any fail, nor is the passed in "nodepath" 
argument string empty (which is necessary to test here in order to be 
able to (mis-)use an empty nodepath string as a flag whether a 
"nodepath" argument has already been processed).

Pretty dense code, I admit.

Stephan


More information about the LibreOffice mailing list