[zypp-devel] Deprecated just for the fun of it?
/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...
Selectable.h:
/**
* True if installed object is present.
* \deprecated Use ! installedEmpty()
*/
ZYPP_DEPRECATED bool hasInstalledObj() const
{ return ! installedEmpty(); }
/** True if candidate object is present. */
bool hasCandidateObj() const
{ return candidateObj(); }
/** True if installed and candidate object is present */
bool hasBothObjects() const
{ return (! installedEmpty()) && candidateObj(); }
/** True if installed object is present but no candidate. */
bool hasInstalledObjOnly() const
{ return (! installedEmpty()) && ! candidateObj(); }
/** True if candidate object is present but no installed. */
bool hasCandidateObjOnly() const
{ return ( installedEmpty() ) && candidateObj(); }
Now somebody please explain what this might be good for.
If there is a simple substitute (and there is), and that older function now
simply calls that substitute (which it does), why not simply KEEP that old
function that is now declared deprecated?
In particular when there is half a dozen other functions that do very similar
things, have very similar names, but are NOT deprecated??
CU
--
Stefan Hundhammer
On Thu, Jun 19, Stefan Hundhammer wrote:
/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...
Selectable.h:
/** * True if installed object is present. * \deprecated Use ! installedEmpty() */ ZYPP_DEPRECATED bool hasInstalledObj() const { return ! installedEmpty(); }
/** True if candidate object is present. */ bool hasCandidateObj() const { return candidateObj(); }
/** True if installed and candidate object is present */ bool hasBothObjects() const { return (! installedEmpty()) && candidateObj(); }
/** True if installed object is present but no candidate. */ bool hasInstalledObjOnly() const { return (! installedEmpty()) && ! candidateObj(); }
/** True if candidate object is present but no installed. */ bool hasCandidateObjOnly() const { return ( installedEmpty() ) && candidateObj(); }
Now somebody please explain what this might be good for.
Someone's been overeager beautifying the interface. bool hasInstalledObj() const is the counterpart to bool hasCandidateObj() const Use it. I'll remove the tag. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Stefan Hundhammer wrote:
/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. Duncan -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Wednesday 25 June 2008 15:29, Duncan Mac-Vicar Prett wrote:
/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
participants (3)
-
Duncan Mac-Vicar Prett
-
Michael Andres
-
Stefan Hundhammer