ignore
[platform/upstream/libzypp.git] / zypp / Source.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Source.cc
10  *
11 */
12 #include <cassert>
13
14 #include <iostream>
15
16 #include "zypp/Source.h"
17 #include "zypp/source/SourceImpl.h"
18 #include "zypp/SourceFactory.h"
19
20 using namespace std;
21
22 ///////////////////////////////////////////////////////////////////
23 namespace zypp
24 { /////////////////////////////////////////////////////////////////
25
26   const Source_Ref Source_Ref::noSource;
27
28   ///////////////////////////////////////////////////////////////////
29   //
30   //    METHOD NAME : Source_Ref::Source_Ref
31   //    METHOD TYPE : Ctor
32   //
33   Source_Ref::Source_Ref()
34   : _pimpl( Impl::nullimpl() )
35   {}
36
37   ///////////////////////////////////////////////////////////////////
38   //
39   //    METHOD NAME : Source_Ref::Source_Ref
40   //    METHOD TYPE : Ctor
41   //
42   Source_Ref::Source_Ref( const Impl_Ptr & impl_r )
43   : _pimpl( impl_r )
44   {
45     assert( impl_r );
46   }
47
48   ///////////////////////////////////////////////////////////////////
49   //
50   //    Forward to SourceImpl:
51   //
52   ///////////////////////////////////////////////////////////////////
53
54   Source_Ref::NumericId Source_Ref::numericId() const
55   { return _pimpl->numericId(); }
56
57   bool Source_Ref::resStoreInitialized() const
58   { return _pimpl->resStoreInitialized(); }
59
60   const ResStore & Source_Ref::resolvables() const
61   { return _pimpl->resolvables(); }
62
63   const ResStore Source_Ref::resolvables(zypp::Resolvable::Kind kind) const
64   { return _pimpl->resolvables(kind); }
65
66   const Pathname Source_Ref::provideFile(const Pathname & file_r,
67                                      const unsigned media_nr)
68   { return _pimpl->provideFile(file_r, media_nr); }
69
70   const Pathname Source_Ref::provideDirTree(const Pathname & dir_r,
71                                             const unsigned media_nr)                                              
72   { return _pimpl->provideDirTree(dir_r, media_nr); }
73
74   const Pathname Source_Ref::providePackage( Package::constPtr package )
75   { return _pimpl->providePackage( package ); }
76   
77   const void Source_Ref::releaseFile(const Pathname & file_r,
78                                      const unsigned media_nr)
79   { _pimpl->releaseFile(file_r, media_nr); }
80
81   const void Source_Ref::releaseDir(const Pathname & dir_r,
82                                     const unsigned media_nr,
83                                     bool recursive)
84   { _pimpl->releaseDir(dir_r, media_nr, recursive); }
85
86   bool Source_Ref::enabled() const
87   { return _pimpl->enabled(); }
88
89   void Source_Ref::enable()
90   { _pimpl->enable(); }
91
92   void Source_Ref::disable()
93   { _pimpl->disable(); }
94
95   Date Source_Ref::timestamp() const
96   { return _pimpl->timestamp(); }
97   
98   std::string Source_Ref::checksum() const
99   { return _pimpl->checksum(); }
100   
101   bool Source_Ref::autorefresh() const
102   { return _pimpl->autorefresh(); }
103
104   void Source_Ref::setAutorefresh( bool enable_r )
105   { _pimpl->setAutorefresh( enable_r ); }
106
107   void Source_Ref::refresh()
108   { _pimpl->refresh() ; }
109
110   void Source_Ref::storeMetadata(const Pathname & cache_dir_r)
111   { _pimpl->storeMetadata(cache_dir_r); }
112
113   string Source_Ref::alias (void) const
114   { return _pimpl->alias(); }
115
116   void Source_Ref::setAlias (const std::string & alias_r)
117   { _pimpl->setAlias( alias_r ); }
118
119   string Source_Ref::type (void) const
120   { return _pimpl->type(); }
121
122   string Source_Ref::id (void) const
123   { return _pimpl->id(); }
124
125   void Source_Ref::setId (const std::string id_r)
126   { return _pimpl->setId (id_r); }
127
128   string Source_Ref::zmdName (void) const
129   { return _pimpl->zmdName(); }
130
131   void Source_Ref::setZmdName (const std::string name_r)
132   { return _pimpl->setZmdName( name_r ); }
133
134   string Source_Ref::zmdDescription (void) const
135   { return _pimpl->zmdDescription(); }
136
137   void Source_Ref::setZmdDescription (const std::string desc_r)
138   { return _pimpl->setZmdDescription( desc_r ); }
139
140   unsigned Source_Ref::priority (void) const
141   { return _pimpl->priority(); }
142
143   void Source_Ref::setPriority (unsigned p)
144   { return _pimpl->setPriority(p); }
145
146   unsigned Source_Ref::priorityUnsubscribed (void) const
147   { return _pimpl->priorityUnsubscribed(); }
148
149   void Source_Ref::setPriorityUnsubscribed (unsigned p)
150   { return _pimpl->setPriorityUnsubscribed( p ); }
151
152   bool Source_Ref::subscribed(void) const
153   { return _pimpl->subscribed(); }
154
155   void Source_Ref::setSubscribed (bool s)
156   { return _pimpl->setSubscribed( s ); }
157
158   Url Source_Ref::url (void) const
159   { return _pimpl->url (); }
160
161   void Source_Ref::setUrl( const Url & url )
162   { _pimpl->setUrl( url ); }
163
164   bool Source_Ref::remote (void) const
165   { return _pimpl->remote (); }
166
167   const Pathname & Source_Ref::path (void) const
168   { return _pimpl->path (); }
169
170   bool Source_Ref::baseSource() const
171   { return _pimpl->baseSource(); }
172
173   const Pathname & Source_Ref::cacheDir (void) const
174   { return _pimpl->cacheDir (); }
175
176   void Source_Ref::changeMedia(const media::MediaId & media_r, const Pathname & path_r)
177   { _pimpl->changeMedia(media_r, path_r); }
178
179   void Source_Ref::redirect(unsigned media_nr, const Url & new_url)
180   { _pimpl->redirect(media_nr, new_url); }
181
182   void Source_Ref::release()
183   { _pimpl->release(); }
184
185   void Source_Ref::reattach(const Pathname &attach_point)
186   { _pimpl->reattach(attach_point); }
187
188   media::MediaVerifierRef Source_Ref::verifier(unsigned media_nr)
189   { return _pimpl->verifier(media_nr); }
190
191   unsigned Source_Ref::numberOfMedia(void) const
192   { return _pimpl->numberOfMedia(); }
193
194   std::string Source_Ref::vendor (void) const
195   { return _pimpl->vendor(); }
196
197   const std::list<Pathname> Source_Ref::publicKeys()
198   { return _pimpl->publicKeys(); }
199
200   std::string Source_Ref::unique_id (void) const
201   { return _pimpl->unique_id(); }
202
203   bool Source_Ref::hasResolvablesOfKind( const zypp::Resolvable::Kind &kind ) const
204   { return _pimpl->resolvableKinds().count(kind) != 0; }
205   
206   std::set<zypp::Resolvable::Kind> Source_Ref::resolvableKinds() const
207   { return _pimpl->resolvableKinds(); }
208   
209   /******************************************************************
210    **
211    **   FUNCTION NAME : operator<<
212    **   FUNCTION TYPE : std::ostream &
213   */
214   std::ostream & operator<<( std::ostream & str, const Source_Ref & obj )
215   {
216     return str << *obj._pimpl;
217   }
218
219   /////////////////////////////////////////////////////////////////
220 } // namespace zypp
221 ///////////////////////////////////////////////////////////////////