Mailinglist Archive: zypp-devel (83 mails)
| < Previous | Next > |
Re: [zypp-devel] Deprecated just for the fun of it?
- From: Stefan Hundhammer <sh@xxxxxxx>
- Date: Wed, 25 Jun 2008 15:58:45 +0200
- Message-id: <200806251558.45499.sh@xxxxxxx>
On Wednesday 25 June 2008 15:29, Duncan Mac-Vicar Prett wrote:
That doesn't make the old function hasInstalledObj() any less valid or useful.
It queries if there is an installed object, i.e. if the number of installed
objects is > 0. If there can now be more than one installed object, that
doesn't change anything: The function will return 'true' just as well. The
number of installed objects is irrelevant here, just the fact that there is
at least one.
That's also why the comment says what to use now as a replacement:
Selectable.h:
/**
* True if installed object is present.
* \deprecated Use ! installedEmpty()
*/
ZYPP_DEPRECATED bool hasInstalledObj() const
{ return ! installedEmpty(); }
So rather than obfuscate the calling code with the negated counterpart, we
might as well simply keep the original function.
CU
--
Stefan Hundhammer <sh@xxxxxxx> Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
/local_home/sh/yast2/trunk/qt-pkg/src/YQPkgObjList.cc:540:
warning: 'hasInstalledObj' is deprecated (declared
at /usr/include/zypp/ui/Selectable.h:163)
OK. So that function is deprecated. Hopefully there is a substitute for
it that does the same thing in some modern, fancy way. But...
The replacement is just installedEmpty and no, it was not deprecated for
fun. As there is no longer _one_ installed object, it is consistent to
ask for the emptyness or the size of the container of installed objects.
That doesn't make the old function hasInstalledObj() any less valid or useful.
It queries if there is an installed object, i.e. if the number of installed
objects is > 0. If there can now be more than one installed object, that
doesn't change anything: The function will return 'true' just as well. The
number of installed objects is irrelevant here, just the fact that there is
at least one.
That's also why the comment says what to use now as a replacement:
Selectable.h:
/**
* True if installed object is present.
* \deprecated Use ! installedEmpty()
*/
ZYPP_DEPRECATED bool hasInstalledObj() const
{ return ! installedEmpty(); }
So rather than obfuscate the calling code with the negated counterpart, we
might as well simply keep the original function.
CU
--
Stefan Hundhammer <sh@xxxxxxx> Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |