libzypp  11.13.5
Locks.h
Go to the documentation of this file.
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 
9 namespace zypp
10 {
18  class Locks
19  {
20  public:
21  typedef std::list<PoolQuery> LockList;
22  typedef LockList::const_iterator const_iterator;
24  public:
25  class Impl;
26 
31  static Locks& instance();
32 
33  const_iterator begin() const;
34  const_iterator end() const;
35  LockList::size_type size() const;
36  bool empty() const;
37 
47  void addLock( const PoolQuery& query );
48 
53  void addLock( const IdString& ident_r );
54 
59  void addLock( const ResKind& kind_r, const IdString& name_r );
60 
65  void addLock( const ResKind& kind_r, const C_Str& name_r );
66 
73  void removeLock( const PoolQuery& query );
74 
81  void removeLock( const IdString& ident_r );
82 
89  void removeLock( const ResKind& kind_r, const IdString& name_r );
90  void removeLock( const ResKind& kind_r, const C_Str & name_r );
91 
97  void readAndApply( const Pathname& file = ZConfig::instance().locksFile() );
98 
103  void read( const Pathname& file = ZConfig::instance().locksFile() );
104 
108  void apply() const;
109 
115  void save( const Pathname& file = ZConfig::instance().locksFile() );
116 
122  void merge();
123 
129  bool existEmpty() const;
130 
137  void removeEmpty();
138 
143  void removeDuplicates();
145  private:
146  Locks();
147 
149 
150  };
151 }
152 
153 #endif