libzypp  10.5.0
Locks.h
Go to the documentation of this file.
00001 #ifndef ZYPP_LOCKS_H
00002 #define ZYPP_LOCKS_H
00003 
00004 #include "zypp/ResPool.h"
00005 #include "zypp/Pathname.h"
00006 #include "zypp/PoolQuery.h"
00007 #include "zypp/ZConfig.h"
00008  
00009 namespace zypp
00010 {
00018   class Locks
00019   {
00020   public:
00021     typedef std::list<PoolQuery> LockList;
00022     typedef LockList::const_iterator const_iterator;
00023     typedef LockList::size_type size_type;
00024   public:
00025     class Impl;
00026 
00031     static Locks& instance();
00032 
00033     const_iterator begin() const;
00034     const_iterator end() const;
00035     LockList::size_type size() const;
00036     bool empty() const;
00037 
00047     void addLock( const PoolQuery& query );
00048 
00053     void addLock( const IdString& ident_r );
00054 
00059     void addLock( const ResKind& kind_r, const IdString& name_r );
00060 
00065     void addLock( const ResKind& kind_r, const C_Str& name_r );
00066 
00073     void removeLock( const PoolQuery& query );
00074 
00081     void removeLock( const IdString& ident_r );
00082 
00089     void removeLock( const ResKind& kind_r, const IdString& name_r );
00090     void removeLock( const ResKind& kind_r, const C_Str & name_r );
00091 
00097     void readAndApply( const Pathname& file = ZConfig::instance().locksFile() );
00098 
00103     void read( const Pathname& file = ZConfig::instance().locksFile() );
00104 
00108     void apply() const;
00109 
00115     void save( const Pathname& file = ZConfig::instance().locksFile() );
00116 
00122     void merge();
00123     
00129     bool existEmpty() const;
00130 
00137     void removeEmpty();
00138 
00143     void removeDuplicates();
00145   private:
00146     Locks();
00147     
00148     RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
00149 
00150   };
00151 }
00152     
00153 #endif