/usr/include/x86_64-linux-gnu/zypp/Resolvable.h is in libzypp-dev 15.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | /*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/Resolvable.h
*
*/
#ifndef ZYPP_RESOLVABLE_H
#define ZYPP_RESOLVABLE_H
#include <iosfwd>
#include <string>
#include "zypp/APIConfig.h"
#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
#include "zypp/base/PtrTypes.h"
#include "zypp/sat/Solvable.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
class PoolItem;
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Resolvable
//
/** Interface base for resolvable objects (identification and dependencies).
* \todo Merge with ResObject
*/
class Resolvable : protected zypp::sat::Solvable, // Note: gcc bug #52841 prohibits using just sat::Solvable
public base::ReferenceCounted, private base::NonCopyable
{
friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
public:
typedef Resolvable Self;
typedef ResTraits<Self> TraitsType;
typedef TraitsType::KindType Kind;
typedef TraitsType::PtrType Ptr;
typedef TraitsType::constPtrType constPtr;
public:
/** Whether this represents an installed solvable. */
bool isSystem() const
{ return sat::Solvable::isSystem(); }
/** \copydoc sat::Solvable::onSystemByUser() */
bool onSystemByUser() const
{ return sat::Solvable::onSystemByUser(); }
IdString ident() const
{ return sat::Solvable::ident(); }
ResKind kind() const
{ return sat::Solvable::kind(); }
bool isKind( const ResKind & kind_r ) const
{ return sat::Solvable::isKind( kind_r ); }
template<class _Res>
bool isKind() const
{ return sat::Solvable::isKind<_Res>(); }
std::string name() const
{ return sat::Solvable::name(); }
Edition edition() const
{ return sat::Solvable::edition(); }
Arch arch() const
{ return sat::Solvable::arch(); }
/** Whether different versions of this package can be installed at the same time.
* Per default \c false. \see also \ref ZConfig::multiversion.
*/
bool multiversionInstall() const
{ return sat::Solvable::multiversionInstall(); }
using sat::Solvable::asString;
using sat::Solvable::asUserString;
/** \name Dependencies. */
//@{
/** Select by Dep. */
Capabilities dep( Dep which_r ) const
{ return operator[]( which_r ); }
Capabilities operator[]( Dep which_r ) const
{ return sat::Solvable::operator[]( which_r ); }
Capabilities provides() const
{ return sat::Solvable::provides(); }
Capabilities requires() const
{ return sat::Solvable::requires(); }
Capabilities conflicts() const
{ return sat::Solvable::conflicts(); }
Capabilities obsoletes() const
{ return sat::Solvable::obsoletes(); }
Capabilities recommends() const
{ return sat::Solvable::recommends(); }
Capabilities suggests() const
{ return sat::Solvable::suggests(); }
Capabilities enhances() const
{ return sat::Solvable::enhances(); }
Capabilities supplements() const
{ return sat::Solvable::supplements(); }
Capabilities prerequires() const
{ return sat::Solvable::prerequires(); }
CapabilitySet providesNamespace( const std::string & namespace_r ) const
{ return sat::Solvable::providesNamespace( namespace_r ); }
CapabilitySet valuesOfNamespace( const std::string & namespace_r ) const
{ return sat::Solvable::valuesOfNamespace( namespace_r ); }
//@}
public:
/** Access the corresponding \ref sat:::Solvable. */
const sat::Solvable & satSolvable() const { return *this; }
/** Access the corresponding \ref PoolItem. */
PoolItem poolItem() const;
protected:
/** Ctor */
Resolvable( const sat::Solvable & solvable_r );
/** Dtor */
virtual ~Resolvable();
/** Helper for stream output */
virtual std::ostream & dumpOn( std::ostream & str ) const;
};
///////////////////////////////////////////////////////////////////
/** \relates Resolvable Stream output */
inline std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
{ return obj.dumpOn( str ); }
/** \relates Resolvable More verbose stream output including dependencies */
inline std::ostream & dumpOn( std::ostream & str, const Resolvable & obj )
{ return dumpOn( str, obj.satSolvable() ); }
/** Test whether a Resolvable::Ptr is of a certain Kind.
* \return \c Ture iff \a p is not \c NULL and points to a Resolvable
* of the specified Kind.
* \relates Resolvable
* \code
* isKind<Package>(resPtr);
* \endcode
*/
template<class _Res>
inline bool isKind( const Resolvable::constPtr & p )
{ return p && p->kind() == ResTraits<_Res>::kind; }
// Specialization for Resolvable: Always true.
template<>
inline bool isKind<Resolvable>( const Resolvable::constPtr & p )
{ return !!p; }
// Specialization for ResObject: Always true.
template<>
inline bool isKind<ResObject>( const Resolvable::constPtr & p )
{ return !!p; }
/** Convert Resolvable::Ptr into Ptr of a certain Kind.
* \return \c NULL iff \a p is \c NULL or points to a Resolvable
* not of the specified Kind.
* \relates Resolvable
* \code
* asKind<Package>(resPtr);
* \endcode
*/
template<class _Res>
inline typename ResTraits<_Res>::PtrType asKind( const Resolvable::Ptr & p )
{ return dynamic_pointer_cast<_Res>(p); }
template<class _Res>
inline typename ResTraits<_Res>::constPtrType asKind( const Resolvable::constPtr & p )
{ return dynamic_pointer_cast<const _Res>(p); }
///////////////////////////////////////////////////////////////////
/** \relates Resolvable Compare Resolvable::constPtr according to
* \a kind and \a name.
*/
inline int compareByN( const Resolvable::constPtr & lhs,
const Resolvable::constPtr & rhs )
{
if ( lhs == rhs )
return 0;
if ( ! (lhs && rhs) )
return lhs ? 1 : -1;
int res = 0;
if ( (res = lhs->kind().compare( rhs->kind() )) )
return res;
return lhs->name().compare( rhs->name() );
}
/** \relates Resolvable Compare Resolvable::constPtr according to
* \a kind, \a name and \a edition(compare!).
*/
inline int compareByNVR( const Resolvable::constPtr & lhs,
const Resolvable::constPtr & rhs )
{
if ( lhs == rhs )
return 0;
if ( ! (lhs && rhs) )
return lhs ? 1 : -1;
int res = 0;
if ( (res = lhs->kind().compare( rhs->kind() )) )
return res;
if ( (res = lhs->name().compare( rhs->name() )) )
return res;
return lhs->edition().compare( rhs->edition() );
}
/** \relates Resolvable Compare Resolvable::constPtr according to
* \a kind, \a name, \a edition(compare!) and \a arch.
*/
inline int compareByNVRA( const Resolvable::constPtr & lhs,
const Resolvable::constPtr & rhs )
{
if ( lhs == rhs )
return 0;
if ( ! (lhs && rhs) )
return lhs ? 1 : -1;
int res = 0;
if ( (res = lhs->kind().compare( rhs->kind() )) )
return res;
if ( (res = lhs->name().compare( rhs->name() )) )
return res;
if ( (res = lhs->edition().compare( rhs->edition() )) )
return res;
return lhs->arch().compare( rhs->arch() );
}
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_RESOLVABLE_H
|