libzypp  17.37.5
MediaUrl.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
11 #include "MediaUrl.h"
12 
13 namespace zypp::media {
14 
15  MediaUrl::MediaUrl(Url url, std::unordered_map<std::string, std::any> settings)
16  : _url( std::move(url) )
17  , _settings( std::move(settings) )
18  { }
19 
20  bool MediaUrl::hasConfig(const std::string &key) const
21  {
22  return (_settings.count (key) > 0);
23  }
24 
25  void MediaUrl::setConfig(const std::string &key, std::any value)
26  {
27  _settings.insert_or_assign ( key, std::move(value) );
28  }
29 
30  const std::any &MediaUrl::getConfig(const std::string &key) const
31  {
32  return _settings.at(key);
33  }
34 
35  const MediaUrl::SettingsMap &MediaUrl::config() const
36  {
37  return _settings;
38  }
39 
40  const zypp::Url &MediaUrl::url() const
41  {
42  return _url;
43  }
44 
45  void MediaUrl::setUrl(const zypp::Url &newUrl)
46  {
47  _url = newUrl;
48  }
49 
50  std::ostream & operator<<( std::ostream & str, const MediaUrl & url )
51  {
52  return str << url.url().asString();
53  }
54 
55  bool operator<( const MediaUrl &lhs, const MediaUrl &rhs )
56  {
57  return (lhs.url().asCompleteString() < rhs.url().asCompleteString());
58  }
59 
60  bool operator==( const MediaUrl &lhs, const MediaUrl &rhs )
61  {
62  return (lhs.url().asCompleteString() == rhs.url().asCompleteString());
63  }
64 
65  bool operator!=( const MediaUrl &lhs, const MediaUrl &rhs )
66  {
67  return (lhs.url().asCompleteString() != rhs.url().asCompleteString());
68  }
69 
70 
71 }
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
String related utilities and Regular expression matching.
Definition: Arch.h:363
bool operator<(const MediaUrl &lhs, const MediaUrl &rhs)
Definition: MediaUrl.cc:55
zypp::Url _url
bool operator!=(const MediaUrl &lhs, const MediaUrl &rhs)
Definition: MediaUrl.cc:65
bool operator==(const MediaUrl &lhs, const MediaUrl &rhs)
Definition: MediaUrl.cc:60
Url manipulation class.
Definition: Url.h:92