#include <Rel.h>
Public Types | |
| enum | for_use_in_switch { EQ_e, NE_e, LT_e, LE_e, GT_e, GE_e, ANY_e, NONE_e } |
| Enumarators provided only for use inSwitch statement. More... | |
Public Member Functions | |
| Rel () | |
| DefaultCtor ANY. | |
| Rel (const std::string &strval_r) | |
| Ctor from string. | |
| const std::string & | asString () const |
| String representation of relational operator. | |
| for_use_in_switch | inSwitch () const |
Enumarator provided for use in switch statement. | |
Static Public Attributes | |
Relational operators | |
These are the real relational operator contants to use.
Don't mind that it's not an enum. See also: zypp::Rel::inSwitch | |
| static const Rel | EQ |
| static const Rel | NE |
| static const Rel | LT |
| static const Rel | LE |
| static const Rel | GT |
| static const Rel | GE |
| static const Rel | ANY |
| static const Rel | NONE |
Private Member Functions | |
| Rel (for_use_in_switch op_r) | |
| Ctor to initialize the relational operator contants. | |
Private Attributes | |
| for_use_in_switch | _op |
| The operator. | |
Related Functions | |
| (Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &str, const Rel &obj) |
| Stream output. | |
| bool | operator== (const Rel &lhs, const Rel &rhs) |
| bool | operator!= (const Rel &lhs, const Rel &rhs) |
Yes, it could as well be simply an enum.
Yes, you can use the relational operators as if it was an enum.
Except for use in a switch statement; see inSwitch for this.
But we want to construct them from a string representation, as well as providing one. And this way they are wrapped into a namespace, which is a good idea anyway.
ANY and NONE are somewhat special. ANY is the operator created by the default ctor, and it should always resolve to true. This may be handy in queries when you're looking for a Resolvable in ANY Edition if no operator was specified. While NONE should always resolve to false.
Definition at line 43 of file Rel.h.
| zypp::Rel::Rel | ( | const std::string & | strval_r | ) | [explicit] |
Ctor from string.
Legal values for strval_r are: "==", "!=", "<", "<=", ">", ">=",
as well as "EQ", "NE", "LT", "LE", "GT", "GE", "ANY", "NONE"
and "" (empty string resolves to ANY).
Lower case names are accepted as well.
| PARSE | if strval_r is not legal. |
| zypp::Rel::Rel | ( | for_use_in_switch | op_r | ) | [inline, private] |
| const std::string & zypp::Rel::asString | ( | ) | const |
String representation of relational operator.
Definition at line 78 of file Rel.cc.
References _op, zypp::_table, ANY_e, EQ_e, GE_e, GT_e, LE_e, LT_e, NE_e, and NONE_e.
Referenced by zypp::capability::buildHal(), zypp::capability::buildModalias(), zypp::capability::ModaliasCap::encode(), zypp::capability::HalCap::encode(), and operator<<().
| for_use_in_switch zypp::Rel::inSwitch | ( | ) | const [inline] |
Enumarator provided for use in switch statement.
The sole reason for providing enum for_use_in_switch is, that we may want to use the relational operators in a switch statement. Tht's the only case where you should have to use the enumarator.
Rel op; switch ( op.inSwitch() ) { case Rel::EQ_e: ... break; case Rel::NE_e: ... // No default! Let compiler warn if case is missing }
Definition at line 107 of file Rel.h.
References _op.
Referenced by zypp::compareByRel(), zypp::capability::isEditionSpec(), and operator==().
| std::ostream & operator<< | ( | std::ostream & | str, | |
| const Rel & | obj | |||
| ) | [related] |
const Rel zypp::Rel::EQ [static] |
Definition at line 50 of file Rel.h.
Referenced by zypp::storage::XMLFilesBackend::createPatch(), zypp::CompareByEQ< _Tp, _Compare >::operator()(), zypp::operator==(), zypp::NVRA::operator==(), zypp::NVR::operator==(), zypp::Edition::operator==(), zypp::range_detail::overlaps(), zypp::parser::susetags::ContentFileReader::parse(), and zypp::solver::detail::QueueItemUninstall::process().
const Rel zypp::Rel::NE [static] |
Definition at line 51 of file Rel.h.
Referenced by zypp::NVRA::operator!=(), zypp::NVR::operator!=(), zypp::Edition::operator!=(), zypp::CompareByNE< _Tp, _Compare >::operator()(), and zypp::range_detail::overlaps().
const Rel zypp::Rel::LT [static] |
Definition at line 52 of file Rel.h.
Referenced by zypp::CompareByLT< _Tp, _Compare >::operator()(), zypp::NVRA::operator<(), zypp::NVR::operator<(), zypp::Edition::operator<(), and zypp::range_detail::overlaps().
const Rel zypp::Rel::LE [static] |
Definition at line 53 of file Rel.h.
Referenced by zypp::CompareByLE< _Tp, _Compare >::operator()(), zypp::Edition::operator<=(), and zypp::range_detail::overlaps().
const Rel zypp::Rel::GT [static] |
Definition at line 54 of file Rel.h.
Referenced by zypp::CompareByGT< _Tp, _Compare >::operator()(), zypp::Edition::operator>(), and zypp::range_detail::overlaps().
const Rel zypp::Rel::GE [static] |
Definition at line 55 of file Rel.h.
Referenced by zypp::CompareByGE< _Tp, _Compare >::operator()(), zypp::Edition::operator>=(), and zypp::range_detail::overlaps().
const Rel zypp::Rel::ANY [static] |
Definition at line 56 of file Rel.h.
Referenced by zypp::capability::VersionedCap::encode(), zypp::capability::ModaliasCap::encode(), zypp::capability::HalCap::encode(), zypp::solver::detail::helixXML(), zypp::CompareByANY< _Tp, _Compare >::operator()(), zypp::locks::AddLockToPool::operator()(), zypp::operator==(), zypp::range_detail::overlaps(), zypp::solver::detail::QueueItemRequire::process(), zypp::target::modalias::Modalias::Impl::query(), and zypp::target::hal::Hal::Impl::query().
const Rel zypp::Rel::NONE [static] |
Definition at line 57 of file Rel.h.
Referenced by zypp::solver::detail::helixXML(), zypp::capability::NamedCap::op(), zypp::CompareByNONE< _Tp, _Compare >::operator()(), zypp::locks::AddLockToPool::operator()(), zypp::operator==(), and zypp::range_detail::overlaps().
for_use_in_switch zypp::Rel::_op [private] |
1.5.3