- make more functions const
- replace add/remove by selectable to add/remove by ident or name and kind
-SET(LIBZYPP_MINOR "13")
-SET(LIBZYPP_COMPATMINOR "13")
-SET(LIBZYPP_PATCH "3")
+SET(LIBZYPP_MINOR "14")
+SET(LIBZYPP_COMPATMINOR "14")
+SET(LIBZYPP_PATCH "0")
#include "zypp/PoolQueryUtil.tcc"
#include "zypp/ZYppCallbacks.h"
#include "zypp/sat/SolvAttr.h"
#include "zypp/PoolQueryUtil.tcc"
#include "zypp/ZYppCallbacks.h"
#include "zypp/sat/SolvAttr.h"
+#include "zypp/sat/Solvable.h"
#include "zypp/PathInfo.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#include "zypp/PathInfo.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
Locks::Locks() : _pimpl(new Impl){}
Locks::Locks() : _pimpl(new Impl){}
-Locks::iterator Locks::begin()
+Locks::const_iterator Locks::begin() const
{ return _pimpl->locks.begin(); }
{ return _pimpl->locks.begin(); }
-Locks::iterator Locks::end()
+Locks::const_iterator Locks::end() const
{ return _pimpl->locks.end(); }
{ return _pimpl->locks.end(); }
-Locks::LockList::size_type Locks::size()
+Locks::LockList::size_type Locks::size() const
{ return _pimpl->locks.size(); }
{ return _pimpl->locks.size(); }
+bool Locks::empty() const
{ return _pimpl->locks.empty(); }
struct ApplyLock
{ return _pimpl->locks.empty(); }
struct ApplyLock
+void Locks::apply() const
{
DBG << "apply locks" << endl;
for_each(begin(), end(), ApplyLock());
{
DBG << "apply locks" << endl;
for_each(begin(), end(), ApplyLock());
-void Locks::addLock(const ui::Selectable& selectable)
+void Locks::addLock( const IdString& ident_r )
+{
+ sat::Solvable::SplitIdent id(ident_r);
+ addLock(id.kind(),id.name());
+}
+
+void Locks::addLock( const ResKind& kind_r, const C_Str & name_r )
+{
+ addLock(kind_r,IdString(name_r));
+}
+
+void Locks::addLock( const ResKind& kind_r, const IdString& name_r )
- q.addAttribute( sat::SolvAttr::name,selectable.name() );
- q.addKind( selectable.kind() );
+ q.addAttribute( sat::SolvAttr::name,name_r.asString() );
+ q.addKind( kind_r );
q.setMatchExact();
q.setCaseSensitive(true);
q.setMatchExact();
q.setCaseSensitive(true);
- DBG << "add lock by selectactable" << endl;
+ DBG << "add lock by identifier" << endl;
-void Locks::removeLock( const ui::Selectable& s )
+void Locks::removeLock( const IdString& ident_r )
+{
+ sat::Solvable::SplitIdent id(ident_r);
+ removeLock(id.kind(),id.name());
+}
+
+void Locks::removeLock( const ResKind& kind_r, const C_Str & name_r )
+{
+ removeLock(kind_r,IdString(name_r));
+}
+
+void Locks::removeLock( const ResKind &kind_r, const IdString &name_r )
- q.addAttribute( sat::SolvAttr::name,s.name() );
- q.addKind( s.kind() );
+ q.addAttribute( sat::SolvAttr::name,name_r.asString() );
+ q.addKind( kind_r );
q.setMatchExact();
q.setCaseSensitive(true);
q.requireAll();
q.setMatchExact();
q.setCaseSensitive(true);
q.requireAll();
-bool Locks::existEmpty()
+bool Locks::existEmpty() const
{
for_( it, _pimpl->locks.begin(), _pimpl->locks.end() )
{
{
for_( it, _pimpl->locks.begin(), _pimpl->locks.end() )
{
#include "zypp/Pathname.h"
#include "zypp/PoolQuery.h"
#include "zypp/ZConfig.h"
#include "zypp/Pathname.h"
#include "zypp/PoolQuery.h"
#include "zypp/ZConfig.h"
-#include "zypp/ui/Selectable.h"
{
public:
typedef std::list<PoolQuery> LockList;
{
public:
typedef std::list<PoolQuery> LockList;
- typedef LockList::const_iterator iterator;
+ typedef LockList::const_iterator const_iterator;
public:
class Impl;
static Locks& instance();
public:
class Impl;
static Locks& instance();
- iterator begin();
- iterator end();
- LockList::size_type size();
- bool empty();
+ const_iterator begin() const;
+ const_iterator end() const;
+ LockList::size_type size() const;
+ bool empty() const;
void addLock( const PoolQuery& query );
/**
void addLock( const PoolQuery& query );
/**
+ * add lock by identifier (f.e. Selectable->ident()
- void addLock( const ui::Selectable& selectable );
+ void addLock( const IdString& ident_r );
+
+ /**
+ * add lock by name and kind
+ */
+ void addLock( const ResKind& kind_r, const IdString& name_r );
+ void addLock( const ResKind& kind_r, const C_Str& name_r );
/**
* unlocks all solvables which is result of query.
/**
* unlocks all solvables which is result of query.
*/
void removeLock( const PoolQuery& query );
*/
void removeLock( const PoolQuery& query );
- void removeLock( const ui::Selectable& selectable );
+ /**
+ * add lock by identifier (f.e. Selectable->ident()
+ */
+ void removeLock( const IdString& ident_r );
+
+ /**
+ * add lock by name and kind
+ */
+ void removeLock( const ResKind& kind_r, const IdString& name_r );
+ void removeLock( const ResKind& kind_r, const C_Str & name_r );
void readAndApply( const Pathname& file = ZConfig::instance().locksFile() );
void read( const Pathname& file = ZConfig::instance().locksFile() );
void readAndApply( const Pathname& file = ZConfig::instance().locksFile() );
void read( const Pathname& file = ZConfig::instance().locksFile() );
void save( const Pathname& file = ZConfig::instance().locksFile() );
void save( const Pathname& file = ZConfig::instance().locksFile() );
+ bool existEmpty() const;
{ return _pimpl->end(); }
{ return _pimpl->end(); }
- bool PoolQuery::empty()
+ bool PoolQuery::empty() const
{ return _pimpl->begin() == _pimpl->end(); }
//! \todo collect the result, reuse if not dirty
{ return _pimpl->begin() == _pimpl->end(); }
//! \todo collect the result, reuse if not dirty
- PoolQuery::size_type PoolQuery::size()
+ PoolQuery::size_type PoolQuery::size() const
{
size_type count = 0;
for(const_iterator it = _pimpl->begin(); it != _pimpl->end(); ++it, ++count);
{
size_type count = 0;
for(const_iterator it = _pimpl->begin(); it != _pimpl->end(); ++it, ++count);
/** */
const_iterator end() const;
/** */
/** */
const_iterator end() const;
/** */
+ size_type size() const;