With a bit of trickery and the Curiously recurring template pattern we
can free us from our use of virtual in the iterators were it is unneeded
bloat as we never deal with pointers to iterators and similar such.
Git-Dch: Ignore
need to have for doing some walk-over-the-cache magic */
template<typename Str, typename Itr> class pkgCache::Iterator :
public std::iterator<std::forward_iterator_tag, Str> {
need to have for doing some walk-over-the-cache magic */
template<typename Str, typename Itr> class pkgCache::Iterator :
public std::iterator<std::forward_iterator_tag, Str> {
- protected:
- Str *S;
- pkgCache *Owner;
-
/** \brief Returns the Pointer for this struct in the owner
* The implementation of this method should be pretty short
* as it will only return the Pointer into the mmap stored
/** \brief Returns the Pointer for this struct in the owner
* The implementation of this method should be pretty short
* as it will only return the Pointer into the mmap stored
* basic methods from the actual structure.
* \return Pointer to the first structure of this type
*/
* basic methods from the actual structure.
* \return Pointer to the first structure of this type
*/
- virtual Str* OwnerPointer() const = 0;
+ Str* OwnerPointer() const { return static_cast<Itr const*>(this)->OwnerPointer(); }
+
+ protected:
+ Str *S;
+ pkgCache *Owner;
- virtual void operator ++(int) = 0;
- virtual void operator ++() = 0; // Should be {operator ++(0);}
inline bool end() const {return Owner == 0 || S == OwnerPointer();}
// Comparison
inline bool end() const {return Owner == 0 || S == OwnerPointer();}
// Comparison
class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
long HashIndex;
class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
long HashIndex;
inline Group* OwnerPointer() const {
return (Owner != 0) ? Owner->GrpP : 0;
}
inline Group* OwnerPointer() const {
return (Owner != 0) ? Owner->GrpP : 0;
}
// This constructor is the 'begin' constructor, never use it.
explicit inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(Owner), HashIndex(-1) {
S = OwnerPointer();
// This constructor is the 'begin' constructor, never use it.
explicit inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(Owner), HashIndex(-1) {
S = OwnerPointer();
- virtual void operator ++(int);
- virtual void operator ++() {operator ++(0);}
+ GrpIterator& operator++();
+ inline GrpIterator operator++(int) { GrpIterator const tmp(*this); operator++(); return tmp; }
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
inline PkgIterator PackageList() const;
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
inline PkgIterator PackageList() const;
class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
long HashIndex;
class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
long HashIndex;
inline Package* OwnerPointer() const {
return (Owner != 0) ? Owner->PkgP : 0;
}
inline Package* OwnerPointer() const {
return (Owner != 0) ? Owner->PkgP : 0;
}
// This constructor is the 'begin' constructor, never use it.
explicit inline PkgIterator(pkgCache &Owner) : Iterator<Package, PkgIterator>(Owner), HashIndex(-1) {
S = OwnerPointer();
// This constructor is the 'begin' constructor, never use it.
explicit inline PkgIterator(pkgCache &Owner) : Iterator<Package, PkgIterator>(Owner), HashIndex(-1) {
S = OwnerPointer();
- virtual void operator ++(int);
- virtual void operator ++() {operator ++(0);}
+ PkgIterator& operator++();
+ inline PkgIterator operator++(int) { PkgIterator const tmp(*this); operator++(); return tmp; }
enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure};
enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure};
/*}}}*/
// Version Iterator /*{{{*/
class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
/*}}}*/
// Version Iterator /*{{{*/
class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
inline Version* OwnerPointer() const {
return (Owner != 0) ? Owner->VerP : 0;
}
inline Version* OwnerPointer() const {
return (Owner != 0) ? Owner->VerP : 0;
}
- void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;}
- inline void operator ++() {operator ++(0);}
+ inline VerIterator& operator++() {if (S != Owner->VerP) S = Owner->VerP + S->NextVer; return *this;}
+ inline VerIterator operator++(int) { VerIterator const tmp(*this); operator++(); return tmp; }
// Comparison
int CompareVer(const VerIterator &B) const;
// Comparison
int CompareVer(const VerIterator &B) const;
/*}}}*/
// Description Iterator /*{{{*/
class pkgCache::DescIterator : public Iterator<Description, DescIterator> {
/*}}}*/
// Description Iterator /*{{{*/
class pkgCache::DescIterator : public Iterator<Description, DescIterator> {
inline Description* OwnerPointer() const {
return (Owner != 0) ? Owner->DescP : 0;
}
inline Description* OwnerPointer() const {
return (Owner != 0) ? Owner->DescP : 0;
}
- void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;}
- inline void operator ++() {operator ++(0);}
+ inline DescIterator& operator++() {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc; return *this;}
+ inline DescIterator operator++(int) { DescIterator const tmp(*this); operator++(); return tmp; }
// Comparison
int CompareDesc(const DescIterator &B) const;
// Comparison
int CompareDesc(const DescIterator &B) const;
class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
enum {DepVer, DepRev} Type;
class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
enum {DepVer, DepRev} Type;
inline Dependency* OwnerPointer() const {
return (Owner != 0) ? Owner->DepP : 0;
}
inline Dependency* OwnerPointer() const {
return (Owner != 0) ? Owner->DepP : 0;
}
- void operator ++(int) {if (S != Owner->DepP) S = Owner->DepP +
- (Type == DepVer ? S->NextDepends : S->NextRevDepends);}
- inline void operator ++() {operator ++(0);}
+ inline DepIterator& operator++() {if (S != Owner->DepP) S = Owner->DepP +
+ (Type == DepVer ? S->NextDepends : S->NextRevDepends); return *this;}
+ inline DepIterator operator++(int) { DepIterator const tmp(*this); operator++(); return tmp; }
// Accessors
inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;}
// Accessors
inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;}
class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
enum {PrvVer, PrvPkg} Type;
class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
enum {PrvVer, PrvPkg} Type;
inline Provides* OwnerPointer() const {
return (Owner != 0) ? Owner->ProvideP : 0;
}
inline Provides* OwnerPointer() const {
return (Owner != 0) ? Owner->ProvideP : 0;
}
- void operator ++(int) {if (S != Owner->ProvideP) S = Owner->ProvideP +
- (Type == PrvVer?S->NextPkgProv:S->NextProvides);}
- inline void operator ++() {operator ++(0);}
+ inline PrvIterator& operator ++() {if (S != Owner->ProvideP) S = Owner->ProvideP +
+ (Type == PrvVer?S->NextPkgProv:S->NextProvides); return *this;}
+ inline PrvIterator operator++(int) { PrvIterator const tmp(*this); operator++(); return tmp; }
// Accessors
inline const char *Name() const {return ParentPkg().Name();}
// Accessors
inline const char *Name() const {return ParentPkg().Name();}
/*}}}*/
// Release file /*{{{*/
class pkgCache::RlsFileIterator : public Iterator<ReleaseFile, RlsFileIterator> {
/*}}}*/
// Release file /*{{{*/
class pkgCache::RlsFileIterator : public Iterator<ReleaseFile, RlsFileIterator> {
inline ReleaseFile* OwnerPointer() const {
return (Owner != 0) ? Owner->RlsFileP : 0;
}
inline ReleaseFile* OwnerPointer() const {
return (Owner != 0) ? Owner->RlsFileP : 0;
}
- void operator ++(int) {if (S != Owner->RlsFileP) S = Owner->RlsFileP + S->NextFile;}
- inline void operator ++() {operator ++(0);}
+ inline RlsFileIterator& operator++() {if (S != Owner->RlsFileP) S = Owner->RlsFileP + S->NextFile;return *this;}
+ inline RlsFileIterator operator++(int) { RlsFileIterator const tmp(*this); operator++(); return tmp; }
// Accessors
inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
// Accessors
inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
/*}}}*/
// Package file /*{{{*/
class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator> {
/*}}}*/
// Package file /*{{{*/
class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator> {
inline PackageFile* OwnerPointer() const {
return (Owner != 0) ? Owner->PkgFileP : 0;
}
inline PackageFile* OwnerPointer() const {
return (Owner != 0) ? Owner->PkgFileP : 0;
}
- void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;}
- inline void operator ++() {operator ++(0);}
+ inline PkgFileIterator& operator++() {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile; return *this;}
+ inline PkgFileIterator operator++(int) { PkgFileIterator const tmp(*this); operator++(); return tmp; }
// Accessors
inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
// Accessors
inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
/*}}}*/
// Version File /*{{{*/
class pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFileIterator> {
/*}}}*/
// Version File /*{{{*/
class pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFileIterator> {
inline VerFile* OwnerPointer() const {
return (Owner != 0) ? Owner->VerFileP : 0;
}
inline VerFile* OwnerPointer() const {
return (Owner != 0) ? Owner->VerFileP : 0;
}
- void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;}
- inline void operator ++() {operator ++(0);}
+ inline VerFileIterator& operator++() {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile; return *this;}
+ inline VerFileIterator operator++(int) { VerFileIterator const tmp(*this); operator++(); return tmp; }
// Accessors
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}
// Accessors
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}
/*}}}*/
// Description File /*{{{*/
class pkgCache::DescFileIterator : public Iterator<DescFile, DescFileIterator> {
/*}}}*/
// Description File /*{{{*/
class pkgCache::DescFileIterator : public Iterator<DescFile, DescFileIterator> {
inline DescFile* OwnerPointer() const {
return (Owner != 0) ? Owner->DescFileP : 0;
}
inline DescFile* OwnerPointer() const {
return (Owner != 0) ? Owner->DescFileP : 0;
}
- void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;}
- inline void operator ++() {operator ++(0);}
+ inline DescFileIterator& operator++() {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile; return *this;}
+ inline DescFileIterator operator++(int) { DescFileIterator const tmp(*this); operator++(); return tmp; }
// Accessors
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}
// Accessors
inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}
}
PackageContainerInterface::~PackageContainerInterface() {}
}
PackageContainerInterface::~PackageContainerInterface() {}
-PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) { }
+PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) {}
+PackageUniverse::PackageUniverse(pkgCacheFile * const Owner) : _cont(Owner->GetPkgCache()), d(NULL) {}
PackageUniverse::~PackageUniverse() {}
VersionContainerInterface::VersionContainerInterface() : d(NULL) {}
PackageUniverse::~PackageUniverse() {}
VersionContainerInterface::VersionContainerInterface() : d(NULL) {}
// Iterator templates for our Containers /*{{{*/
template<typename Interface, typename Master, typename iterator_type, typename container_iterator, typename container_value> class Container_iterator_base :
public std::iterator<typename std::iterator_traits<container_iterator>::iterator_category, container_iterator>,
// Iterator templates for our Containers /*{{{*/
template<typename Interface, typename Master, typename iterator_type, typename container_iterator, typename container_value> class Container_iterator_base :
public std::iterator<typename std::iterator_traits<container_iterator>::iterator_category, container_iterator>,
- public Interface::iterator_base
+ public Interface::template iterator_base<iterator_type>
{
protected:
container_iterator _iter;
public:
explicit Container_iterator_base(container_iterator i) : _iter(i) {}
{
protected:
container_iterator _iter;
public:
explicit Container_iterator_base(container_iterator i) : _iter(i) {}
- inline container_value operator*(void) const { return this->getType(); }
+ inline container_value operator*(void) const { return static_cast<iterator_type const*>(this)->getType(); };
operator container_iterator(void) const { return _iter; }
inline iterator_type& operator++() { ++_iter; return static_cast<iterator_type&>(*this); }
inline iterator_type operator++(int) { iterator_type tmp(*this); operator++(); return tmp; }
operator container_iterator(void) const { return _iter; }
inline iterator_type& operator++() { ++_iter; return static_cast<iterator_type&>(*this); }
inline iterator_type operator++(int) { iterator_type tmp(*this); operator++(); return tmp; }
explicit Container_const_iterator(container_iterator i) :
Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
explicit Container_const_iterator(container_iterator i) :
Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
- inline virtual typename Container::value_type getType(void) const APT_OVERRIDE { return *this->_iter; }
+ inline typename Container::value_type getType(void) const { return *this->_iter; }
};
template<class Interface, class Container, class Master> class Container_iterator :
public Container_iterator_base<Interface, Master, Container_iterator<Interface, Container, Master>, typename Container::iterator, typename Container::value_type>
};
template<class Interface, class Container, class Master> class Container_iterator :
public Container_iterator_base<Interface, Master, Container_iterator<Interface, Container, Master>, typename Container::iterator, typename Container::value_type>
inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
- inline virtual typename Container::value_type getType(void) const APT_OVERRIDE { return *this->_iter; }
+ inline typename Container::value_type getType(void) const { return *this->_iter; }
};
template<class Interface, class Container, class Master> class Container_const_reverse_iterator :
public Container_iterator_base<Interface, Master, Container_const_reverse_iterator<Interface, Container, Master>, typename Container::const_reverse_iterator, typename Container::value_type>
};
template<class Interface, class Container, class Master> class Container_const_reverse_iterator :
public Container_iterator_base<Interface, Master, Container_const_reverse_iterator<Interface, Container, Master>, typename Container::const_reverse_iterator, typename Container::value_type>
explicit Container_const_reverse_iterator(container_iterator i) :
Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
explicit Container_const_reverse_iterator(container_iterator i) :
Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
- inline virtual typename Container::value_type getType(void) const APT_OVERRIDE { return *this->_iter; }
+ inline typename Container::value_type getType(void) const { return *this->_iter; }
};
template<class Interface, class Container, class Master> class Container_reverse_iterator :
public Container_iterator_base<Interface, Master, Container_reverse_iterator<Interface, Container, Master>, typename Container::reverse_iterator, typename Container::value_type>
};
template<class Interface, class Container, class Master> class Container_reverse_iterator :
public Container_iterator_base<Interface, Master, Container_reverse_iterator<Interface, Container, Master>, typename Container::reverse_iterator, typename Container::value_type>
inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
- inline virtual typename Container::value_type getType(void) const APT_OVERRIDE { return *this->_iter; }
+ inline typename Container::value_type getType(void) const { return *this->_iter; }
};
/*}}}*/
class PackageContainerInterface { /*{{{*/
};
/*}}}*/
class PackageContainerInterface { /*{{{*/
* This class mostly protects use from the need to write all implementation
* of the methods working on containers in the template */
public:
* This class mostly protects use from the need to write all implementation
* of the methods working on containers in the template */
public:
- class iterator_base { /*{{{*/
- protected:
- virtual pkgCache::PkgIterator getType() const = 0;
+ template<class Itr> class iterator_base { /*{{{*/
+ pkgCache::PkgIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
public:
operator pkgCache::PkgIterator(void) const { return getType(); }
public:
operator pkgCache::PkgIterator(void) const { return getType(); }
public:
class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>
{
public:
class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>
{
- protected:
- inline virtual pkgCache::PkgIterator getType(void) const APT_OVERRIDE
- {
- return _iter;
- }
public:
explicit const_iterator(pkgCache::PkgIterator i):
Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>(i) {}
public:
explicit const_iterator(pkgCache::PkgIterator i):
Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>(i) {}
+ inline pkgCache::PkgIterator getType(void) const { return _iter; }
};
typedef const_iterator iterator;
};
typedef const_iterator iterator;
- APT_PUBLIC bool empty() const APT_OVERRIDE { return false; }
- APT_PUBLIC size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; }
+ bool empty() const APT_OVERRIDE { return false; }
+ size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; }
- APT_PUBLIC const_iterator begin() const { return const_iterator(_cont->PkgBegin()); }
- APT_PUBLIC const_iterator end() const { return const_iterator(_cont->PkgEnd()); }
- APT_PUBLIC const_iterator cbegin() const { return const_iterator(_cont->PkgBegin()); }
- APT_PUBLIC const_iterator cend() const { return const_iterator(_cont->PkgEnd()); }
- APT_PUBLIC iterator begin() { return iterator(_cont->PkgBegin()); }
- APT_PUBLIC iterator end() { return iterator(_cont->PkgEnd()); }
+ const_iterator begin() const { return const_iterator(_cont->PkgBegin()); }
+ const_iterator end() const { return const_iterator(_cont->PkgEnd()); }
+ const_iterator cbegin() const { return const_iterator(_cont->PkgBegin()); }
+ const_iterator cend() const { return const_iterator(_cont->PkgEnd()); }
+ iterator begin() { return iterator(_cont->PkgBegin()); }
+ iterator end() { return iterator(_cont->PkgEnd()); }
- APT_PUBLIC pkgCache * data() const { return _cont; }
+ pkgCache * data() const { return _cont; }
- explicit APT_PUBLIC PackageUniverse(pkgCache * const Owner);
- APT_PUBLIC virtual ~PackageUniverse();
+ explicit PackageUniverse(pkgCache * const Owner);
+ explicit PackageUniverse(pkgCacheFile * const Owner);
+ virtual ~PackageUniverse();
- bool insert(pkgCache::PkgIterator const &) APT_OVERRIDE { return true; }
- template<class Cont> void insert(PackageContainer<Cont> const &) { }
- void insert(const_iterator, const_iterator) { }
+ APT_HIDDEN bool insert(pkgCache::PkgIterator const &) APT_OVERRIDE { return true; }
+ template<class Cont> APT_HIDDEN void insert(PackageContainer<Cont> const &) { }
+ APT_HIDDEN void insert(const_iterator, const_iterator) { }
- void clear() APT_OVERRIDE { }
- iterator erase( const_iterator pos );
- iterator erase( const_iterator first, const_iterator last );
+ APT_HIDDEN void clear() APT_OVERRIDE { }
+ APT_HIDDEN iterator erase( const_iterator pos );
+ APT_HIDDEN iterator erase( const_iterator first, const_iterator last );
};
/*}}}*/
typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
};
/*}}}*/
typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
Same as APT::PackageContainerInterface, just for Versions */
public:
/** \brief smell like a pkgCache::VerIterator */
Same as APT::PackageContainerInterface, just for Versions */
public:
/** \brief smell like a pkgCache::VerIterator */
- class iterator_base { /*{{{*/
- protected:
- virtual pkgCache::VerIterator getType() const = 0;
+ template<class Itr> class iterator_base { /*{{{*/
+ pkgCache::VerIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
public:
operator pkgCache::VerIterator(void) { return getType(); }
public:
operator pkgCache::VerIterator(void) { return getType(); }
// GrpIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical group in the hash table. */
// GrpIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical group in the hash table. */
-void pkgCache::GrpIterator::operator ++(int)
+pkgCache::GrpIterator& pkgCache::GrpIterator::operator++()
{
// Follow the current links
if (S != Owner->GrpP)
{
// Follow the current links
if (S != Owner->GrpP)
HashIndex++;
S = Owner->GrpP + Owner->HeaderP->GrpHashTableP()[HashIndex];
}
HashIndex++;
S = Owner->GrpP + Owner->HeaderP->GrpHashTableP()[HashIndex];
}
}
/*}}}*/
// PkgIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical package in the hash table. */
}
/*}}}*/
// PkgIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical package in the hash table. */
-void pkgCache::PkgIterator::operator ++(int)
+pkgCache::PkgIterator& pkgCache::PkgIterator::operator ++()
{
// Follow the current links
if (S != Owner->PkgP)
{
// Follow the current links
if (S != Owner->PkgP)
HashIndex++;
S = Owner->PkgP + Owner->HeaderP->PkgHashTableP()[HashIndex];
}
HashIndex++;
S = Owner->PkgP + Owner->HeaderP->PkgHashTableP()[HashIndex];
}
}
/*}}}*/
// PkgIterator::State - Check the State of the package /*{{{*/
}
/*}}}*/
// PkgIterator::State - Check the State of the package /*{{{*/
for (bool LastOR = true; end() == false && LastOR == true;)
{
LastOR = (S->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
for (bool LastOR = true; end() == false && LastOR == true;)
{
LastOR = (S->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
if (LastOR == true)
End = (*this);
}
if (LastOR == true)
End = (*this);
}
class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>
{
pkgCache * const Cache;
class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>
{
pkgCache * const Cache;
- protected:
- inline virtual pkgCache::PkgIterator getType(void) const APT_OVERRIDE
+ public:
+ inline pkgCache::PkgIterator getType(void) const
{
if (*_iter == 0) return pkgCache::PkgIterator(*Cache);
return pkgCache::PkgIterator(*Cache, Cache->PkgP + *_iter);
}
{
if (*_iter == 0) return pkgCache::PkgIterator(*Cache);
return pkgCache::PkgIterator(*Cache, Cache->PkgP + *_iter);
}
explicit const_iterator(pkgCache * const Owner, std::vector<map_pointer_t>::const_iterator i):
Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>(i), Cache(Owner) {}
explicit const_iterator(pkgCache * const Owner, std::vector<map_pointer_t>::const_iterator i):
Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>(i), Cache(Owner) {}