replacing OUString::valueOf(static_cast<sal_Int32>) ??
Noel Grandin
noel at peralex.com
Thu Jan 10 06:05:49 PST 2013
On 2013-01-10 15:55, Lubos Lunak wrote:
> On Thursday 10 of January 2013, Noel Grandin wrote:
>> Created a proof-of-concept patch along with some unit tests and pushed
>> to gerrit:
>>
>> https://gerrit.libreoffice.org/#/c/1625/
> Can we please keep the discussion still here? Gerrit may be fine for pointing
> out technical details in the code, but it's not very suitable for discussions
> about anything beyond that.
That's why it said "proof of concept". Mostly, I did it to point that
someone was willing to do the work :-)
> - 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.
Which doesn't help with overload resolution problems.
>
> - When more or less deprecating valueOf() this way, it has also float
> overloads, so something should be created for those too.
If those also suffer from overload resolution problems, then sure.
But
git grep "String::valueOf.*static_cast<.*double"
doesn't find anything that looks like it needs help.
> - I'm still not sold on the naming, OUString::valueInt() doesn't say much and
> OUString::valueOfInt() feels cryptic. Can we please use something obvious
> that doesn't need decyphering, such as OUString::number() or
> OUString::fromInt() (as much as I still don't like the idea of harcoding the
> irrelevant type information in the name)?
Which would be inconsistent with the existing method names.
>
> I expect it won't, regular expressions can't tell what foo is in "valueOf(
> foo )".
Actually, regex can. It's called capturing groups.
http://www.regular-expressions.info/brackets.html
Doesn't work very well with complex expressions, but it can handle the
simple cases.
> Unless all you want to convert is only places which do the explicit
> cast, this will need a (fairly simple) Clang plugin.
Sure, if you feel like writing one.
Disclaimer: http://www.peralex.com/disclaimer.html
More information about the LibreOffice
mailing list