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"
21 #include "zypp/ResTraits.h"
23 #include "zypp/ResKind.h"
24 #include "zypp/Edition.h"
25 #include "zypp/Arch.h"
26 #include "zypp/Dependencies.h"
28 ///////////////////////////////////////////////////////////////////
30 { /////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////
34 // CLASS NAME : Resolvable
36 /** Interface base for resolvable objects (identification and dependencies).
37 * \todo Solve ResKind problems via traits template?
39 class Resolvable : public base::ReferenceCounted, private base::NonCopyable
42 typedef Resolvable Self;
43 typedef base::intrusive_ptr<Self> Ptr;
44 typedef base::intrusive_ptr<const Self> constPtr;
45 friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
49 const ResKind & kind() const;
51 const std::string & name() const;
53 const Edition & edition() const;
55 const Arch & arch() const;
57 const Dependencies & deps() const;
59 void setDeps( const Dependencies & val_r );
63 Resolvable( const ResKind & kind_r,
64 const std::string & name_r,
65 const Edition & edition_r,
66 const Arch & arch_r );
68 virtual ~Resolvable();
69 /** Helper for stream output */
70 virtual std::ostream & dumpOn( std::ostream & str ) const;
75 /** Pointer to implementation */
76 base::ImplPtr<Impl> _pimpl;
78 ///////////////////////////////////////////////////////////////////
83 ///////////////////////////////////////////////////////////////////
85 /** Required by base::intrusive_ptr to add a reference. */
86 inline void intrusive_ptr_add_ref( const Resolvable * ptr_r )
87 { base::ReferenceCounted::add_ref( ptr_r ); }
89 /** Required by base::intrusive_ptr to release a reference. */
90 inline void intrusive_ptr_release( const Resolvable * ptr_r )
91 { base::ReferenceCounted::release( ptr_r ); }
93 /** \relates Resolvable Stream output via Resolvable::dumpOn */
94 inline std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
95 { return obj.dumpOn( str ); }
97 /////////////////////////////////////////////////////////////////
99 ///////////////////////////////////////////////////////////////////
100 #endif // ZYPP_RESOLVABLE_H