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