replacing OUString::valueOf(static_cast<sal_Int32>) ??
Noel Grandin
noel at peralex.com
Fri Jan 11 04:12:41 PST 2013
On 2013-01-11 14:02, Jan Holesovsky wrote:
> Noel Grandin píše v Pá 11. 01. 2013 v 08:46 +0200:
>
>>> - There's no need for valueOfChar(). There is already OUString ctor from
>>> sal_Unicode, so the valueOf() overload for it is just making an obvious thing
>>> complicated. Code using it can be converted to use the ctor instead.
>> I've already dealt with why we can't use the constructor.
>> git grep "String::valueOf.*Unicode"
>> says we do in fact appear to need such a method.
> I've had a look at this git grep, and most of them could be written an
> easier way thanks to the Lubos' OUString magic; like:
>
> - aPropName += OUString::valueOf( (sal_Unicode) '/' );
> + aPropName += "/";
>
> The only more tricky one is
>
> - aRepresentation += OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ) );
> + aRepresentation += OUString( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ) );
>
> Or did you mean something different?
OK, in that case, I'll drop the valueOfChar() methods.
>>> - It's a question if we really need 'OUString::valueOfBool( foo )' instead of
>>> simply 'foo ? OUString( "true" ) : OUString( "false" )' (such a pity the
>>> string literals handling doesn't allow "foo ? "true" : "false"' ). I wonder
>>> how many places in the code really need to convert a boolean to the hardcoded
>>> english string representation.
>> I have no idea how to count call sites automatically.
>> But at least 10 places need to use a cast to access the method, so there
>> is definitely code using it.
> I've counted exactly 5 - seeing the trouble we have un-publishing
> something that we have published, I'd really prefer not to introduce a
> method in our core API that would satisfy only 5 callers ;-)
>
>
OK, fair enough.
Disclaimer: http://www.peralex.com/disclaimer.html
More information about the LibreOffice
mailing list