replacing OUString::valueOf(static_cast<sal_Int32>) ??
Lubos Lunak
l.lunak at suse.cz
Thu Jan 10 10:03:19 PST 2013
On Thursday 10 of January 2013, Noel Grandin wrote:
> You are correct, we are indeed talking past each other.
> If you go back to the very first message in this thread, the patch
> mentioned there will perhaps help to establish come context.
>
> But I will try to explain again.
>
> The constructors and existing methods don't help because the specific
> problem we are trying to solve is that the C++ overload resolution rules
> will sometimes pick a non-intuitive method or constructor to apply.
>
> This leads to code that looks like:
>
> aStyleName.Append( OUString::valueOf( static_cast<sal_Int32>( nDepth ) ) );
>
> which is the integer case. Similar problems apply to the char and bool
> cases.
>
> The purpose of these methods is purely to reduce this boilerplate coding
> and increase readability, so that we have:
>
> aStyleName.Append( OUString::valueOfInt( nDepth ) );
>
> Given that our string classes are used pretty much everywhere, having a
> wide API that increases readability can only be a good thing.
>
> While you might not like the names of the new methods, I don't see how
> making the names of the new methods dramatically different from the names
> of the existing "valueOf" methods can be an improvement to the API.
> Sometimes, we have to work with what we have.
That is not what I meant. What I wrote in my previous mail is that if these
valueOf() issues are to be fixed, it's better to fix it completely rather
than just slightly reduce the problem. And for that it would be better to
remove the original valueOf() completely, and that results in all the
follow-up issues that I raised.
--
Lubos Lunak
l.lunak at suse.cz
More information about the LibreOffice
mailing list