- removed superfluous namespace thingy
[platform/upstream/libzypp.git] / zypp / Repository.h
1
2 #ifndef ZYPP_REPOSITORY_H
3 #define ZYPP_REPOSITORY_H
4
5 #include <iosfwd>
6 #include <string>
7
8 #include "zypp/base/PtrTypes.h"
9 #include "zypp/base/SafeBool.h"
10 //#include "zypp/ResStore.h"
11 #include "zypp/RepoInfo.h"
12 #include "zypp/repo/PackageDelta.h"
13
14 namespace zypp
15 {
16   class ResStore;
17
18   namespace repo
19   {
20     DEFINE_PTR_TYPE(RepositoryImpl);
21     class RepositoryImpl;
22   }
23
24   class Repository : private base::SafeBool<Repository>
25   {
26   public:
27     typedef repo::RepositoryImpl     Impl;
28     typedef repo::RepositoryImpl_Ptr Impl_Ptr;
29
30   public:
31
32     /**
33      * \short Default ctor: noRepository.
34      * \see RepoManager::createFromCache.
35     */
36     Repository();
37
38     /** \short Factory ctor taking a RepositoryImpl.
39      * This is quite low level. You usually want to use RepoManager to
40      * manage the repositories.
41      * \see RepoManager
42     */
43     explicit
44     Repository( const Impl_Ptr & impl_r );
45
46     /**
47      * A dummy Repository (Id \c 0) providing nothing, doing nothing.
48     */
49     static const Repository noRepository;
50
51     /** Validate Repository in a boolean context.
52      * \c FALSE iff == noRepository.
53     */
54     using base::SafeBool<Repository>::operator bool_type;
55
56   public:
57     typedef unsigned long NumericId;
58
59     /** Runtime unique numeric Repository Id. */
60     NumericId numericId() const;
61
62     /**
63      * \short Get the resolvables for repo
64      */
65     const ResStore & resolvables() const;
66
67     /**
68      * \short Repository info used to create this repository
69      */
70     const RepoInfo & info() const;
71
72     /**
73      * \short Patch RPMs the repository provides
74      */
75     const std::list<packagedelta::PatchRpm> & patchRpms() const;
76
77     /**
78      * \short Delta RPMs the repository provides
79      */
80     const std::list<packagedelta::DeltaRpm> & deltaRpms() const;
81
82   private:
83     friend base::SafeBool<Repository>::operator bool_type() const;
84     /** \ref SafeBool test. */
85     bool boolTest() const
86     { return _pimpl != noRepository._pimpl; }
87
88   private:
89     /** Pointer to implementation */
90     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
91   };
92
93   /** \relates Repository */
94   std::ostream & operator<<( std::ostream & str, const Repository & obj );
95   /** \relates Repository */
96   bool operator==( const Repository & lhs, const Repository & rhs );
97   /** \relates Repository */
98   inline bool operator!=( const Repository & lhs, const Repository & rhs )
99   { return !( lhs == rhs ); }
100   /** \relates Repository */
101   bool operator<( const Repository & lhs, const Repository & rhs );
102
103 }
104
105 #endif
106
107