51c57c821e0b77db603d0e18d780a3cbc75f0c79
[platform/upstream/libzypp.git] / zypp / Locks.h
1
2 #ifndef ZYPP_LOCKS_H
3 #define ZYPP_LOCKS_H
4
5 #include "zypp/ResPool.h"
6 #include "zypp/Pathname.h"
7 #include "zypp/PoolQuery.h"
8 #include "zypp/ZConfig.h"
9 #include "zypp/ui/Selectable.h"
10
11 namespace zypp
12 {
13   namespace locks
14   {
15     class Locks
16     {
17     public:
18       class Impl;
19
20       static Locks& instance();
21
22       /**
23        * locks all solvables which is result of query
24        */
25       void addLock( const PoolQuery& query );
26
27       /**
28        * locks selectable
29        */
30       void addLock( const ui::Selectable& selectable );
31
32       /**
33        * unlocks all solvables which is result of query.
34        * Can call callback
35        */
36       void unlock( const PoolQuery& query );
37
38       void unlock( const ui::Selectable& selectable );
39
40       void loadLocks( const Pathname& file = ZConfig::instance().locksFile() );
41
42       void saveLocks( const Pathname& file = ZConfig::instance().locksFile() );
43
44       bool existEmptyLocks();
45
46       void removeEmptyLocks();
47
48     private:
49       Locks();
50       
51       RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
52
53     };
54   }
55 }
56     
57 #endif
58