1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ResObject.h
12 #ifndef ZYPP_RESOBJECT_H
13 #define ZYPP_RESOBJECT_H
15 #include "zypp/base/Deprecated.h"
17 #include "zypp/detail/ResObjectImplIf.h"
18 #include "zypp/Resolvable.h"
19 #include "zypp/TranslatedText.h"
20 #include "zypp/NeedAType.h"
22 ///////////////////////////////////////////////////////////////////
24 { /////////////////////////////////////////////////////////////////
27 class ResObjectImplIf;
32 ///////////////////////////////////////////////////////////////////
34 // CLASS NAME : ResObject
36 /** Interface base for resolvable objects (common data).
38 class ResObject : public Resolvable
41 typedef detail::ResObjectImplIf Impl;
42 typedef ResObject Self;
43 typedef ResTraits<Self> TraitsType;
44 typedef TraitsType::PtrType Ptr;
45 typedef TraitsType::constPtrType constPtr;
52 Text description() const;
55 Text insnotify() const;
58 Text delnotify() const;
61 Text licenseToConfirm() const;
64 Vendor vendor() const;
67 ByteCount size() const;
70 ByteCount archivesize() const;
72 /** Backlink to the source providing this. */
73 Source_Ref source() const;
75 /** Number of the source media that provides the data
76 * required for installation. Zero, if no media access
79 unsigned sourceMediaNr() const;
81 /** Use sourceMediaNr */
82 ZYPP_DEPRECATED unsigned mediaId() const
83 { return sourceMediaNr(); }
86 bool installOnly() const;
89 Date buildtime() const;
91 /** Time of installation, or \c 0 */
92 Date installtime() const;
99 ResObject( const Kind & kind_r,
100 const NVRAD & nvrad_r );
102 virtual ~ResObject();
104 /** Helper for stream output */
105 virtual std::ostream & dumpOn( std::ostream & str ) const;
108 friend class detail::ImplConnect;
109 /** Access implementation */
110 virtual Impl & pimpl() = 0;
111 /** Access implementation */
112 virtual const Impl & pimpl() const = 0;
114 ///////////////////////////////////////////////////////////////////
116 /** Convert ResObject::Ptr into Ptr of a certain Kind.
117 * \return \c NULL iff \a p is \c NULL or points to a Resolvable
118 * not of the specified Kind.
121 * asKind<Package>(resPtr);
125 inline typename ResTraits<_Res>::PtrType asKind( const ResObject::Ptr & p )
126 { return dynamic_pointer_cast<_Res>(p); }
129 inline typename ResTraits<_Res>::constPtrType asKind( const ResObject::constPtr & p )
130 { return dynamic_pointer_cast<const _Res>(p); }
132 /////////////////////////////////////////////////////////////////
134 ///////////////////////////////////////////////////////////////////
135 #endif // ZYPP_RESOBJECT_H