Mailinglist Archive: zypp-devel (227 mails)
| < Previous | Next > |
[zypp-devel] SolvIterMixin: Adding PoolItem_iterator and Selectable_iterator
- From: Michael Andres <ma@xxxxxxx>
- Date: Wed, 9 Apr 2008 22:18:56 +0200
- Message-id: <20080409201856.GA11896@xxxxxxx>
I just added a class SolvIterMixin (zypp/sat/SolvIterMixin.h).
Classes providing a sat::Solvable iterator - i.e methods begin() and end()
returning an iterator pointing to sat::Solvable - may derive from it to
add additional iterators. by now:
// value_type sat::Solvable (the same as the derived class' begin/end)
Solvable_iterator solvableBegin() const
Solvable_iterator solvableEnd() const
// value_type PoolItem
PoolItem_iterator poolItemBegin() const
PoolItem_iterator poolItemEnd() const
// value_type ui::Selectable::Ptr
Selectable_iterator selectableBegin() const
Selectable_iterator selectableEnd() const
(The Selectable_iterator will soon be enhanced to avoid multiple visits of
the same Selectable, because multiple Solvables/PoolItems refer to the
same Selectable.)
The intention is that all classes providing a collection of solvables
(Queries, Pattern/Patch contents, ...) offer this interface.
To use SolvIterMixin derive from it and pass the class and the iterator
type as template argument:
* namespace detail
* {
* class WhatProvidesIterator;
* }
*
* class WhatProvides
* : public SolvIterMixin<WhatProvides,detail::WhatProvidesIterator>
* {
* public:
* typedef detail::WhatProvidesIterator const_iterator;
*
* // Iterator pointing to the first Solvable.
* const_iterator begin() const;
*
* // Iterator pointing behind the last Solvable.
* const_iterator end() const;
*
* };
@PoolQuery: The Mixin requires begin/end being const methods, and the
ResultIterator must be defined outside class PoolQuery. Once this is
fixed, PoolQuery could add the SolvIterMixin interface.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
Classes providing a sat::Solvable iterator - i.e methods begin() and end()
returning an iterator pointing to sat::Solvable - may derive from it to
add additional iterators. by now:
// value_type sat::Solvable (the same as the derived class' begin/end)
Solvable_iterator solvableBegin() const
Solvable_iterator solvableEnd() const
// value_type PoolItem
PoolItem_iterator poolItemBegin() const
PoolItem_iterator poolItemEnd() const
// value_type ui::Selectable::Ptr
Selectable_iterator selectableBegin() const
Selectable_iterator selectableEnd() const
(The Selectable_iterator will soon be enhanced to avoid multiple visits of
the same Selectable, because multiple Solvables/PoolItems refer to the
same Selectable.)
The intention is that all classes providing a collection of solvables
(Queries, Pattern/Patch contents, ...) offer this interface.
To use SolvIterMixin derive from it and pass the class and the iterator
type as template argument:
* namespace detail
* {
* class WhatProvidesIterator;
* }
*
* class WhatProvides
* : public SolvIterMixin<WhatProvides,detail::WhatProvidesIterator>
* {
* public:
* typedef detail::WhatProvidesIterator const_iterator;
*
* // Iterator pointing to the first Solvable.
* const_iterator begin() const;
*
* // Iterator pointing behind the last Solvable.
* const_iterator end() const;
*
* };
@PoolQuery: The Mixin requires begin/end being const methods, and the
ResultIterator must be defined outside class PoolQuery. Once this is
fixed, PoolQuery could add the SolvIterMixin interface.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |