Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index



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



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.