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;
33 ///////////////////////////////////////////////////////////////////
35 // CLASS NAME : ResObject
38 * Interface base for resolvable objects (common data).
39 * That is, all data not needed for solving, but common
40 * across all Resolvable kinds.
42 class ResObject : public Resolvable
45 typedef detail::ResObjectImplIf Impl;
46 typedef ResObject Self;
47 typedef ResTraits<Self> TraitsType;
48 typedef TraitsType::PtrType Ptr;
49 typedef TraitsType::constPtrType constPtr;
53 * \short Short text describing the resolvable.
54 * This attribute is usually displayed in columns.
59 * \short Long text describing the resolvable.
61 Text description() const;
64 * \short Installation Notification
66 * This text can be used to tell the user some notes
67 * When he selects the resovable for installation.
69 Text insnotify() const;
72 * \short De-Installation Notification
74 * This text can be used to tell the user some notes
75 * When he selects the resovable for deinstall.
77 Text delnotify() const;
80 * \short License or agreement to accept
82 * Agreement, warning or license the user should
83 * accept before installing the resolvable.
85 Text licenseToConfirm() const;
90 * For Example "Novell Inc."
92 Vendor vendor() const;
94 /** Installed size. */
95 ByteCount size() const;
97 /** Size of the rpm package. */
98 ByteCount archivesize() const;
101 * Source providing this resolvable
103 /*ZYPP_DEPRECATED */ Source_Ref source() const;
106 * Source providing this resolvable
108 Repository repository() const;
111 * Media number where the resolvable is located
112 * 0 if no media access is required.
114 unsigned mediaNr() const;
117 * Media number where the resolvable is located
118 * 0 if no media access is required.
120 /* ZYPP_DEPRECATED */ unsigned sourceMediaNr() const;
123 * \deprecated Use sourceMediaNr
125 /* ZYPP_DEPRECATED */ unsigned mediaId() const
126 { return sourceMediaNr(); }
129 * \TODO FIXME what is this?
131 bool installOnly() const;
134 * \short build time of the resolvable
136 Date buildtime() const;
139 * \short Installation time
140 * 0 if the resolvable is not installed.
142 Date installtime() const;
145 * \deprecated No replacement.
147 ZYPP_DEPRECATED ZmdId zmdid () const;
151 ResObject( const Kind & kind_r,
152 const NVRAD & nvrad_r );
154 virtual ~ResObject();
156 /** Helper for stream output */
157 virtual std::ostream & dumpOn( std::ostream & str ) const;
160 friend class detail::ImplConnect;
161 /** Access implementation */
162 virtual Impl & pimpl() = 0;
163 /** Access implementation */
164 virtual const Impl & pimpl() const = 0;
166 ///////////////////////////////////////////////////////////////////
168 /** Convert ResObject::Ptr into Ptr of a certain Kind.
169 * \return \c NULL iff \a p is \c NULL or points to a Resolvable
170 * not of the specified Kind.
173 * asKind<Package>(resPtr);
177 inline typename ResTraits<_Res>::PtrType asKind( const ResObject::Ptr & p )
178 { return dynamic_pointer_cast<_Res>(p); }
181 inline typename ResTraits<_Res>::constPtrType asKind( const ResObject::constPtr & p )
182 { return dynamic_pointer_cast<const _Res>(p); }
184 /////////////////////////////////////////////////////////////////
186 ///////////////////////////////////////////////////////////////////
187 #endif // ZYPP_RESOBJECT_H