SourceFeed.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_SOURCEFEED_H
00013 #define ZYPP_SOURCEFEED_H
00014 
00015 #include <iosfwd>
00016 #include <set>
00017 
00018 #include "zypp/base/PtrTypes.h"
00019 
00021 namespace zypp
00022 { 
00023 
00024   class ResPoolManager;
00025   class Source_Ref;
00026 
00028   //
00029   //    CLASS NAME : SourceFeed_Ref
00030   //
00034   class SourceFeed_Ref
00035   {
00036     friend std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj );
00037     typedef std::set<Source_Ref> ContainerT;
00038 
00039   public:
00041     class Impl;
00042 
00043     typedef ContainerT::size_type      size_type;
00044     typedef ContainerT::iterator       iterator;
00045     typedef ContainerT::const_iterator const_iterator;
00046 
00047   public:
00049     SourceFeed_Ref( ResPoolManager pool_r );
00051     ~SourceFeed_Ref();
00052 
00053   public:
00054 
00056     void addSource( Source_Ref src_r )
00057     {
00058       ContainerT sources;
00059       sources.insert( src_r );
00060       insert( sources );
00061     }
00062 
00064     template <class _InputIterator>
00065       void addSource( _InputIterator first_r, _InputIterator last_r )
00066       {
00067         ContainerT sources( first_r, last_r );
00068         insert( sources );
00069       }
00070 
00071     // Add defaults from sourcemanager
00072 
00073     // Set sources
00074 
00075   public:
00076 
00078     void removeSource( Source_Ref src_r )
00079     {
00080       ContainerT sources;
00081       sources.insert( src_r );
00082       erase( sources );
00083     }
00084 
00086     template <class _InputIterator>
00087       void removeSource( _InputIterator first_r, _InputIterator last_r )
00088       {
00089         ContainerT sources( first_r, last_r );
00090         erase( sources );
00091       }
00092 
00094     void removeAllSources()
00095     {
00096       removeSource( sourceBegin(), sourceEnd() );
00097     }
00098 
00099   public:
00100 
00102     const_iterator sourceBegin() const;
00103     const_iterator sourceEnd() const;
00104 
00105   private:
00106 
00107     void insert( ContainerT & sources_r );
00108 
00109     void erase( ContainerT & sources_r );
00110 
00111   private:
00113     shared_ptr<Impl> _pimpl;
00114   };
00116 
00118   std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj );
00119 
00121 } // namespace zypp
00123 #endif // ZYPP_SOURCEFEED_H

Generated on Thu Jul 6 00:07:25 2006 for zypp by  doxygen 1.4.6