- Added to ZYpp public interface:
[platform/upstream/libzypp.git] / zypp / ZYpp.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZYpp.h
10  *
11 */
12 #ifndef ZYPP_ZYPP_H
13 #define ZYPP_ZYPP_H
14
15 #include <iosfwd>
16
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/Target.h"
21 #include "zypp/Resolver.h"
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26
27   namespace zypp_detail
28   {
29     class ZYppImpl;
30   }
31
32   class ZYppFactory;
33   class ResPool;
34   class ResPoolProxy;
35   class SourceFeed_Ref;
36   class ResStore;
37   class Locale;
38
39   ///////////////////////////////////////////////////////////////////
40   //
41   //    CLASS NAME : ZYpp
42   //
43   /** */
44   class ZYpp : public base::ReferenceCounted, private base::NonCopyable
45   {
46   public:
47
48     typedef intrusive_ptr<ZYpp>       Ptr;
49     typedef intrusive_ptr<const ZYpp> constPtr;
50
51   public:
52
53     /** Pool of ResStatus for individual ResObjetcs. */
54     ResPool pool() const;
55
56     /** Pool of ui::Selectable.
57      * Based on the ResPool, ui::Selectable groups ResObjetcs of
58      * same kind and name.
59     */
60     ResPoolProxy poolProxy() const;
61
62     /**  */
63     //SourceFeed_Ref sourceFeed() const;
64
65     void addResolvables (const ResStore& store, bool installed = false);
66
67     void removeResolvables (const ResStore& store);
68
69     /**
70      * \throws Exception
71      */
72     Target_Ptr target() const;
73
74     /**
75      * \throws Exception
76      * if commit_only == true, just init, don't populate store or pool
77      */
78     void initTarget(const Pathname & root, bool commit_only = false);
79
80     /**
81      * \throws Exception
82      */
83     void finishTarget();
84
85     /** */
86     Resolver_Ptr resolver() const;
87
88   public:
89     /** Set the preferd locale for translated labels, descriptions,
90      *  etc. passed to the UI.
91      */
92     void setTextLocale( const Locale & textLocale_r );
93     /** */
94     Locale getTextLocale() const;
95
96   public:
97     typedef std::set<Locale> LocaleSet;
98     /** Set the requested locales.
99      * Languages to be supported by the system, e.g. language specific
100      * packages to be installed.
101     */
102     void setRequestedLocales( const LocaleSet & locales_r );
103     /** */
104     LocaleSet getRequestedLocales() const;
105
106   protected:
107     /** Dtor */
108     virtual ~ZYpp();
109     /** Stream output */
110     virtual std::ostream & dumpOn( std::ostream & str ) const;
111   private:
112     /** Factory */
113     friend class ZYppFactory;
114     /** */
115     typedef zypp_detail::ZYppImpl Impl;
116     typedef shared_ptr<Impl>      Impl_Ptr;
117     /** Factory ctor */
118     explicit
119     ZYpp( const Impl_Ptr & impl_r );
120   private:
121     /** Pointer to implementation */
122     RW_pointer<Impl> _pimpl;
123   };
124   ///////////////////////////////////////////////////////////////////
125
126   /////////////////////////////////////////////////////////////////
127 } // namespace zypp
128 ///////////////////////////////////////////////////////////////////
129 #endif // ZYPP_ZYPP_H