Proposal for addition: tristate class - 3-state logical type

Olivier Goffart ogoffart at kde.org
Sat Sep 10 00:17:48 BST 2005


Le Vendredi 9 Septembre 2005 23:54, Jarosław Staniek a écrit :
> File atttached: tristate.h
>
> Proposal for using this at kdelibs level.
>
> Simple yet readable bool type replacement when you need to return a special
> "don't know" or "cancelled" state from your function and you detest
> exceptions like me. I've estarted to use tristate class in apps, including
> Kexi, in 2004 with relative success: I was able to avoid using error-prone
> int type whenever people just want to return 0, 1 or 2 (2=="don't know").
>
> Contains all necessary casts from bool, operators and special 'cancelled'
> value.

That remind me an old thread
http://lists.kde.org/?t=109689376400005&r=1&w=2

My objections are still the same:  it can be done with a simple int or an 
enum. (where, AFAIK, operators like ! and ~ works also)

Can you point me a place in the code where that class will be usefull ?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050910/5c9c2d6d/attachment.sig>


More information about the kde-core-devel mailing list