[Development] New feature to qstring | QString::toBool()
thiago at kde.org
Tue Oct 25 23:01:43 CEST 2011
On Tuesday, 25 de October de 2011 23.19.29, Antonis Tsiapaliokas wrote:
> I have found this feature request to bugzilla,
> https://bugreports.qt.nokia.com/browse/QTBUG-21384 , and i have create a
> patch for this http://codereview.qt-project.org/#change,7394 . Since a
> qstring has the toDouble, toint, toDouble, toFload etc, i think that it
> could be great to add this feature to qstring. Also, please read the comment
> from the John Brooks, which i think that he is right. So what do you think?
> Is there any way to add this feature or it will to hackish? (if we assume
> that we want to support for all the ways that a string can represent a
QVariant has toBool just like it has toDouble and toInt, so I think it makes
sense to have it in QString and in QByteArray.
So I recommend:
1) document very well what is true and what isn't
2) make sure all three classes work the same way. If not, change them so that
they all have toBool() const and they all operate equally.
3) add unit tests
4) ensure that QVariant::toBool calls into QString::toBool and
QByteArray::toBool, as applicable. Note pending the commits by Jędrzej that
are refactoring the QVariant internals.
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 190 bytes
Desc: This is a digitally signed message part.
More information about the Development