1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Resolvable.h
12 #ifndef ZYPP_RESOLVABLE_H
13 #define ZYPP_RESOLVABLE_H
18 #include "zypp/base/ReferenceCounted.h"
19 #include "zypp/base/NonCopyable.h"
20 #include <zypp/base/PtrTypes.h>
22 #include "zypp/ResKind.h"
23 #include "zypp/Edition.h"
24 #include "zypp/Arch.h"
25 #include "zypp/Dependencies.h"
27 ///////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////
31 ///////////////////////////////////////////////////////////////////
33 // CLASS NAME : Resolvable
35 /** Interface base for resolvable objects (identification and depndencies).
36 * \todo Solve ResKind problems via traits template?
38 class Resolvable : public base::ReferenceCounted, private base::NonCopyable
41 typedef Resolvable Self;
42 typedef base::intrusive_ptr<Self> Ptr;
43 typedef base::intrusive_ptr<const Self> constPtr;
44 friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
48 const ResKind & kind() const;
50 const std::string & name() const;
52 const Edition & edition() const;
54 const Arch & arch() const;
56 const Dependencies & deps() const;
58 void setDeps( const Dependencies & val_r );
62 Resolvable( const ResKind & kind_r,
63 const std::string & name_r,
64 const Edition & edition_r,
65 const Arch & arch_r );
67 virtual ~Resolvable();
68 /** Helper for stream output */
69 virtual std::ostream & dumpOn( std::ostream & str ) const;
74 /** Pointer to implementation */
75 base::ImplPtr<Impl> _pimpl;
77 ///////////////////////////////////////////////////////////////////
79 /** Required by base::intrusive_ptr to add a reference. */
80 inline void intrusive_ptr_add_ref( const Resolvable * ptr_r )
81 { base::ReferenceCounted::add_ref( ptr_r ); }
83 /** Required by base::intrusive_ptr to release a reference. */
84 inline void intrusive_ptr_release( const Resolvable * ptr_r )
85 { base::ReferenceCounted::release( ptr_r ); }
87 /** \relates Resolvable Stream output via Resolvable::dumpOn */
88 inline std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
89 { return obj.dumpOn( str ); }
91 /////////////////////////////////////////////////////////////////
93 ///////////////////////////////////////////////////////////////////
94 #endif // ZYPP_RESOLVABLE_H