1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/SourceFeed.h
12 #ifndef ZYPP_SOURCEFEED_H
13 #define ZYPP_SOURCEFEED_H
18 #include "zypp/base/PtrTypes.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////
29 // CLASS NAME : SourceFeed_Ref
31 /** Feed Sources into a ResPool.
32 * \todo Clean up implementation.
36 friend std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj );
37 typedef std::set<Source_Ref> ContainerT;
43 typedef ContainerT::size_type size_type;
44 typedef ContainerT::iterator iterator;
45 typedef ContainerT::const_iterator const_iterator;
49 SourceFeed_Ref( ResPoolManager pool_r );
55 /** Add one Source. */
56 void addSource( Source_Ref src_r )
59 sources.insert( src_r );
63 /** Add Sources from some container. */
64 template <class _InputIterator>
65 void addSource( _InputIterator first_r, _InputIterator last_r )
67 ContainerT sources( first_r, last_r );
71 // Add defaults from sourcemanager
77 /** Remove a Source. */
78 void removeSource( Source_Ref src_r )
81 sources.insert( src_r );
85 /** Remove all Sources mentioned in container. */
86 template <class _InputIterator>
87 void removeSource( _InputIterator first_r, _InputIterator last_r )
89 ContainerT sources( first_r, last_r );
93 /** Remove all Sources. */
94 void removeAllSources()
96 removeSource( sourceBegin(), sourceEnd() );
101 /** Iterate and query */
102 const_iterator sourceBegin() const;
103 const_iterator sourceEnd() const;
107 void insert( ContainerT & sources_r );
109 void erase( ContainerT & sources_r );
112 /** Pointer to implementation: _Ref */
113 shared_ptr<Impl> _pimpl;
115 ///////////////////////////////////////////////////////////////////
117 /** \relates SourceFeed Stream output */
118 std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj );
120 /////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////
123 #endif // ZYPP_SOURCEFEED_H