libzypp  11.13.5
Url.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_URL_H
13 #define ZYPP_URL_H
14 
15 #include "zypp/url/UrlBase.h"
16 #include "zypp/url/UrlUtils.h"
17 
18 
20 namespace zypp
21 {
22 
23  namespace filesystem {
24  class Pathname;
25  }
26  using filesystem::Pathname;
27 
87  class Url
88  {
89  public:
94 
99 
100 
101  ~Url();
102  Url();
103 
114  Url(const Url &url);
115 
116 
127  Url(const zypp::url::UrlRef &url);
128 
129 
143  Url(const std::string &encodedUrl);
144 
145 
146  // -----------------
163  static url::UrlRef
164  parseUrl(const std::string &encodedUrl);
165 
166 
167  // -----------------
182  Url&
183  operator = (const std::string &encodedUrl);
184 
185 
196  Url&
197  operator = (const Url &url);
198 
199 
200  // -----------------
208  static bool
209  registerScheme(const std::string &scheme,
210  url::UrlRef urlImpl);
211 
216  static zypp::url::UrlSchemes
218 
223  static bool
224  isRegisteredScheme(const std::string &scheme);
225 
226 
227  // -----------------
233  getKnownSchemes() const;
234 
235 
250  bool
251  isValidScheme(const std::string &scheme) const;
252 
253 
255  static bool schemeIsLocal( const std::string & scheme_r );
257  bool schemeIsLocal() const { return schemeIsLocal( getScheme() ); }
258 
260  static bool schemeIsRemote( const std::string & scheme_r );
262  bool schemeIsRemote() const { return schemeIsRemote( getScheme() ); }
263 
265  static bool schemeIsVolatile( const std::string & scheme_r );
267  bool schemeIsVolatile() const { return schemeIsVolatile( getScheme() ); }
268 
270  static bool schemeIsDownloading( const std::string & scheme_r );
272  bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); }
273 
283  bool
284  isValid() const;
285 
286 
287  // -----------------
295  std::string
296  asString() const;
297 
310  std::string
311  asString(const ViewOptions &opts) const;
312 
322  std::string
323  asCompleteString() const;
324 
325 
326  // -----------------
331  std::string
332  getScheme() const;
333 
334 
335  // -----------------
345  std::string
346  getAuthority() const;
347 
355  std::string
357 
365  std::string
367 
372  { return ! ( getUsername().empty() || getPassword().empty() ); }
373 
386  std::string
387  getHost(EEncoding eflag = zypp::url::E_DECODED) const;
388 
393  std::string
394  getPort() const;
395 
396 
397  // -----------------
407  std::string
408  getPathData() const;
409 
418  std::string
420 
425  std::string
426  getPathParams() const;
427 
441  getPathParamsVec() const;
442 
464 
481  std::string
482  getPathParam(const std::string &param,
483  EEncoding eflag = zypp::url::E_DECODED) const;
484 
485 
486  // -----------------
496  std::string
497  getQueryString() const;
498 
513  getQueryStringVec() const;
514 
535 
552  std::string
553  getQueryParam(const std::string &param,
554  EEncoding eflag = zypp::url::E_DECODED) const;
555 
556 
557  // -----------------
565  std::string
567 
568 
569  // -----------------
576  void
577  setScheme(const std::string &scheme);
578 
579 
580  // -----------------
594  void
595  setAuthority(const std::string &authority);
596 
606  void
607  setUsername(const std::string &user,
609 
619  void
620  setPassword(const std::string &pass,
622 
643  void
644  setHost(const std::string &host);
645 
653  void
654  setPort(const std::string &port);
655 
656 
657  // -----------------
668  void
669  setPathData(const std::string &pathdata);
670 
678  void
679  setPathName(const std::string &path,
682  void
683  setPathName(const Pathname &path,
686  void
687  setPathName(const char *path,
689 
696  void
697  setPathParams(const std::string &params);
698 
705  void
707 
714  void
716 
726  void
727  setPathParam(const std::string &param, const std::string &value);
728 
729 
730  // -----------------
737  void
738  setQueryString(const std::string &querystr);
739 
746  void
748 
755  void
757 
767  void
768  setQueryParam(const std::string &param, const std::string &value);
769 
778  void
779  delQueryParam(const std::string &param);
780 
781 
782  // -----------------
790  void
791  setFragment(const std::string &fragment,
793 
794 
795  // -----------------
805  getViewOptions() const;
806 
815  void
816  setViewOptions(const ViewOptions &vopts);
817 
818  private:
820  };
821 
822  std::ostream & operator<<( std::ostream & str, const Url & url );
823 
827  bool operator<( const Url &lhs, const Url &rhs );
828 
832  bool operator==( const Url &lhs, const Url &rhs );
833 
834 
835  bool operator!=( const Url &lhs, const Url &rhs );
836 
838 } // namespace zypp
840 
841 #endif /* ZYPP_URL_H */
842 /*
843 ** vim: set ts=2 sts=2 sw=2 ai et:
844 */