12 #ifndef ZYPP_REPO_ORIGIN_INCLUDED_H 13 #define ZYPP_REPO_ORIGIN_INCLUDED_H 18 #include <boost/iterator/iterator_facade.hpp> 46 using SettingsMap = std::unordered_map<std::string, std::any>;
63 bool hasConfig(
const std::string &key )
const;
67 void setConfig(
const std::string &key, std::any value );
68 const std::any &getConfig(
const std::string &key )
const;
69 std::any &getConfig(
const std::string &key );
70 void eraseConfigValue(
const std::string &key );
72 const SettingsMap &config()
const;
73 SettingsMap &config();
77 setConfig( key, std::make_any<T>( std::forward<T>(value) ) );
82 const std::any &c = getConfig(key);
85 const T* ref = std::any_cast<
const T>(&c);
87 throw std::bad_any_cast();
94 std::any &c = getConfig(key);
97 T* ref = std::any_cast<T>(&c);
99 throw std::bad_any_cast();
108 std::string scheme()
const;
113 bool schemeIsDownloading()
const;
115 bool isValid()
const;
173 template <
class Parent,
class Value>
174 class iter :
public boost::iterator_facade<
177 , boost::forward_traversal_tag
183 explicit iter( Parent *list, uint idx )
189 friend class boost::iterator_core_access;
193 return ((this->_list == other.
_list) && (this->_idx == other.
_idx));
201 if ( (_idx+1) > _list->endpointCount() )
208 if ( !_list || _idx >= _list->endpointCount() )
209 throw std::out_of_range(
"OriginEndpoint index out of range." );
210 return _list->operator [](_idx);
213 Parent *_list =
nullptr;
235 const std::vector<OriginEndpoint> &mirrors()
const;
240 bool isValid()
const;
243 void setMirrors( std::vector<OriginEndpoint> mirrors );
249 std::string scheme()
const;
254 bool schemeIsDownloading()
const;
281 uint endpointCount()
const;
328 using iterator = std::vector<MirroredOrigin>::iterator;
386 template<
typename InputIterator>
388 std::for_each(first,last,[
this](
OriginEndpoint ep ) { addEndpoint(std::move(ep));} );
404 void addEndpoints(std::vector<OriginEndpoint> endpoints );
413 const_iterator begin()
const;
416 const_iterator end()
const;
422 size_type size()
const;
432 bool hasFallbackUrls()
const;
bool operator!=(const OriginEndpoint &lhs, const OriginEndpoint &rhs)
needed for find, two OriginEndpoint's are equal when the Urls match, currently settings are not compa...
bool equal(iter< Parent, Value > const &other) const
std::vector< MirroredOrigin >::const_iterator const_iterator
endpoint_const_iterator end() const
String related utilities and Regular expression matching.
RWCOW_pointer< Private > _pimpl
iter(Parent *list, uint idx)
RWCOW_pointer< Private > _pimpl
typename enable_if< B, T >::type enable_if_t
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
bool operator==(const OriginEndpoint &lhs, const OriginEndpoint &rhs)
needed for find, two OriginEndpoint's are equal when the Urls match, currently settings are not compa...
Value & dereference() const
std::vector< MirroredOrigin >::iterator iterator
RWCOW_pointer< Private > _pimpl
void addEndpoints(InputIterator first, InputIterator last)
A convenience method to add multiple endpoints from a range.
const OriginEndpoint & operator[](uint index) const
endpoint_const_iterator begin() const
OriginEndpoint & operator[](uint index)
bool operator<(const OriginEndpoint &lhs, const OriginEndpoint &rhs)
needed for std::set
Represents a single, configurable network endpoint, combining a URL with specific access settings...
endpoint_iterator begin()
A smart container that manages a collection of MirroredOrigin objects, automatically grouping endpoin...
RW_pointer supporting 'copy on write' functionality.