~thopiekar/zypper/libzypp-manual-import

« back to all changes in this revision

Viewing changes to zypp/ZYpp.h

  • Committer: Thomas-Karl Pietrowski
  • Date: 2014-01-29 22:44:28 UTC
  • Revision ID: thopiekar@googlemail.com-20140129224428-gpcqnsdakby362n8
firstĀ import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/APIConfig.h"
 
21
 
 
22
#include "zypp/ZConfig.h"
 
23
#include "zypp/ManagedFile.h"
 
24
 
 
25
#include "zypp/ZYppCommit.h"
 
26
#include "zypp/ResTraits.h"
 
27
 
 
28
#include "zypp/Target.h"
 
29
#include "zypp/Resolver.h"
 
30
#include "zypp/KeyRing.h"
 
31
#include "zypp/DiskUsageCounter.h"
 
32
 
 
33
///////////////////////////////////////////////////////////////////
 
34
namespace zypp
 
35
{ /////////////////////////////////////////////////////////////////
 
36
 
 
37
  namespace zypp_detail
 
38
  {
 
39
    class ZYppImpl;
 
40
  }
 
41
 
 
42
  class ZYppFactory;
 
43
  class ResPool;
 
44
  class ResPoolProxy;
 
45
  class KeyRing;
 
46
 
 
47
  ///////////////////////////////////////////////////////////////////
 
48
  //
 
49
  //    CLASS NAME : ZYpp
 
50
  //
 
51
  /**
 
52
   * \todo define Exceptions
 
53
   * ZYpp API main interface
 
54
   */
 
55
  class ZYpp : public base::ReferenceCounted, private base::NonCopyable
 
56
  {
 
57
  public:
 
58
 
 
59
    typedef intrusive_ptr<ZYpp>       Ptr;
 
60
    typedef intrusive_ptr<const ZYpp> constPtr;
 
61
 
 
62
  public:
 
63
 
 
64
    /**
 
65
     * Access to the global resolvable pool.
 
66
     * Same as \ref zypp::ResPool::instance
 
67
     */
 
68
    ResPool pool() const;
 
69
 
 
70
    /** Pool of ui::Selectable.
 
71
     * Based on the ResPool, ui::Selectable groups ResObjetcs of
 
72
     * same kind and name.
 
73
    */
 
74
    ResPoolProxy poolProxy() const;
 
75
 
 
76
    DiskUsageCounter::MountPointSet diskUsage();
 
77
 
 
78
    void setPartitions(const DiskUsageCounter::MountPointSet &mp);
 
79
 
 
80
    DiskUsageCounter::MountPointSet getPartitions() const;
 
81
 
 
82
  public:
 
83
    /**
 
84
     * \throws Exception
 
85
     */
 
86
    Target_Ptr target() const;
 
87
 
 
88
    /** Same as \ref target but returns NULL if target is not
 
89
     *  initialized, instead of throwing.
 
90
     */
 
91
    Target_Ptr getTarget() const;
 
92
 
 
93
    /**
 
94
     * \throws Exception
 
95
     * Just init the target, dont populate store or pool.
 
96
     * If \c doRebuild_r is \c true, an already existing
 
97
     * database is rebuilt (rpm --rebuilddb ).
 
98
     */
 
99
    void initializeTarget(const Pathname & root, bool doRebuild_r = false);
 
100
 
 
101
    /**
 
102
     * \throws Exception
 
103
     */
 
104
    void finishTarget();
 
105
 
 
106
 
 
107
  public:
 
108
    typedef ZYppCommitResult CommitResult;
 
109
 
 
110
    /** Commit changes and transactions.
 
111
     * \param \ref CommitPolicy
 
112
     * \return \ref CommitResult
 
113
     * \throws Exception
 
114
    */
 
115
    ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
 
116
 
 
117
    /** Install a source package on the Target.
 
118
     * \throws Exception
 
119
     */
 
120
    void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
 
121
 
 
122
    /** Provides a source package on the Target.
 
123
     * \throws Exception
 
124
     */
 
125
    ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
 
126
 
 
127
  public:
 
128
    /** */
 
129
    Resolver_Ptr resolver() const;
 
130
    KeyRing_Ptr keyRing() const;
 
131
 
 
132
  public:
 
133
    /** Get the path where zypp related plugins store persistent data and caches   */
 
134
    Pathname homePath() const;
 
135
 
 
136
    /** Get the path where zypp related plugins store temp data   */
 
137
    Pathname tmpPath() const;
 
138
 
 
139
    /** set the home, if you need to change it */
 
140
    void setHomePath( const Pathname & path );
 
141
 
 
142
  protected:
 
143
    /** Dtor */
 
144
    virtual ~ZYpp();
 
145
    /** Stream output */
 
146
    virtual std::ostream & dumpOn( std::ostream & str ) const;
 
147
  private:
 
148
    /** Factory */
 
149
    friend class ZYppFactory;
 
150
 
 
151
    /** */
 
152
    typedef zypp_detail::ZYppImpl Impl;
 
153
    typedef shared_ptr<Impl>      Impl_Ptr;
 
154
    /** Factory ctor */
 
155
    explicit
 
156
    ZYpp( const Impl_Ptr & impl_r );
 
157
  private:
 
158
    /** Pointer to implementation */
 
159
    RW_pointer<Impl> _pimpl;
 
160
  };
 
161
  ///////////////////////////////////////////////////////////////////
 
162
 
 
163
  /////////////////////////////////////////////////////////////////
 
164
} // namespace zypp
 
165
///////////////////////////////////////////////////////////////////
 
166
#endif // ZYPP_ZYPP_H