~ubuntu-branches/ubuntu/vivid/debtags/vivid-proposed

« back to all changes in this revision

Viewing changes to libapt-front/apt-front/manager.h

  • Committer: Bazaar Package Importer
  • Author(s): Enrico Zini
  • Date: 2006-03-18 20:31:47 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20060318203147-d9uzdeong5f5nk14
Tags: 1.5.5
* Added dumpavail command.
* Don't rebuild the database on install: apt-index-watcher does it instead.
  Closes: #357103.
* Compiles with g++ 4.1.  Closes: #357360.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/** -*- C++ -*-
2
 
        @file manager.h
3
 
        @author Peter Rockai <me@mornfall.net>
4
 
*/
5
 
 
6
 
#include <apt-pkg/packagemanager.h>
7
 
#include <apt-pkg/acquire.h>
8
 
 
9
 
#include <apt-front/utils/shared.h>
10
 
#include <apt-front/progresscallback.h>
11
 
#include <apt-front/cache/cache.h>
12
 
 
13
 
#ifndef APT_FRONT_PACKAGEMANAGER_H
14
 
#define APT_FRONT_PACKAGEMANAGER_H
15
 
 
16
 
namespace aptFront {
17
 
 
18
 
/**
19
 
   @brief Sync cache changes to system, update cache (apt-get update).
20
 
 
21
 
   This class encapsulates all actions libapt-front could be doing and that
22
 
   will have an impact on the state of the system. It can update the cache
23
 
   or commit the changes done in cache to the system (downloading required
24
 
   archives in the process). The ::update interface should work with all
25
 
   available cache components (including debtags), so all you need to do
26
 
   is call manager.update(). You can construct and throw away
27
 
   PackageManager objects at will.
28
 
*/
29
 
class Manager {
30
 
public:
31
 
    Manager( cache::Cache *c = 0 );
32
 
    ~Manager();
33
 
    /**
34
 
       @brief Commit changes done in the associated cache to system.
35
 
 
36
 
       You can only call this when Cache is in consistent state, exception
37
 
       will be thrown otherwise. commit will use the associated
38
 
       ProgressCallback object to report download and install progress.
39
 
    */
40
 
    void commit();
41
 
 
42
 
    void download();
43
 
 
44
 
    /**
45
 
       @brief Update the cache ala apt-get update.
46
 
 
47
 
       This will do a normal cache update, possibly clearing the changed
48
 
       cache states. It will use the associated ProgressCallback object
49
 
       to report download and parsing progress.
50
 
 
51
 
       Returns true if the operation was successfull (false if not)
52
 
    */
53
 
    void update();
54
 
 
55
 
    /// set a ProgressCallback to be used to report progress in update and commit
56
 
    void setProgressCallback( SharedPtr<ProgressCallback> progress);
57
 
    
58
 
    void setUpdateInterval( unsigned interval ) {
59
 
        m_updateInterval = interval;
60
 
    }
61
 
 
62
 
protected:
63
 
    void getArchives();
64
 
 
65
 
    cache::Cache *m_cache;
66
 
    SharedPtr<ProgressCallback> m_progress;
67
 
    unsigned m_updateInterval;
68
 
    pkgPackageManager *m_pm;
69
 
    pkgAcquire *m_fetcher;
70
 
};
71
 
 
72
 
}
73
 
 
74
 
#endif