libzypp  10.5.0
WhatObsoletes.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_SAT_WHATOBSOLETES_H
00013 #define ZYPP_SAT_WHATOBSOLETES_H
00014 
00015 #include <iosfwd>
00016 #include <vector>
00017 
00018 #include "zypp/sat/WhatProvides.h"
00019 
00021 namespace zypp
00022 { 
00023 
00024   namespace sat
00025   { 
00026 
00028     //
00029     //  CLASS NAME : WhatObsoletes
00030     //
00036     class WhatObsoletes : public SolvIterMixin<WhatObsoletes,detail::WhatProvidesIterator>,
00037                           protected detail::PoolMember
00038     {
00039       public:
00040         typedef Solvable  value_type;
00041         typedef unsigned  size_type;
00042 
00043       public:
00045         WhatObsoletes()
00046         : _begin( 0 )
00047         {}
00048 
00050         explicit
00051         WhatObsoletes( Solvable item_r );
00052 
00054         explicit
00055         WhatObsoletes( const PoolItem & item_r );
00056 
00058         explicit
00059         WhatObsoletes( const ResObject_constPtr item_r );
00060 
00062         template <class _Iterator>
00063         WhatObsoletes( _Iterator begin, _Iterator end )
00064         : _begin( 0 )
00065         {
00066           for_( it, begin, end )
00067             ctorAdd( *it );
00068           ctorDone();
00069         }
00070 
00071      public:
00073         bool empty() const
00074         { return ! ( _begin && *_begin ); }
00075 
00077         size_type size() const;
00078 
00079       public:
00080         typedef detail::WhatProvidesIterator const_iterator;
00081 
00083         const_iterator begin() const
00084         { return const_iterator( _begin ); }
00085 
00087         const_iterator end() const
00088         { return const_iterator(); }
00089 
00090       private:
00091         void ctorAdd( const PoolItem & item_r );
00092         void ctorAdd( ResObject_constPtr item_r );
00093         void ctorAdd( Solvable item_r );
00094         void ctorDone();
00095 
00096       private:
00097         const sat::detail::IdType * _begin;
00098         shared_ptr<void> _private;
00099     };
00101 
00103     std::ostream & operator<<( std::ostream & str, const WhatObsoletes & obj );
00104 
00106   } // namespace sat
00109 } // namespace zypp
00111 #endif // ZYPP_SAT_WHATOBSOLETES_H