libzypp 17.35.1
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
17
18
20namespace zypp
21{
22
23 class Url;
24 namespace hotfix1050625 {
25 std::string asString( const Url & url_r );
26 }
27 namespace filesystem {
28 class Pathname;
29 }
30 using filesystem::Pathname;
31
92 {
93 public:
98
103
104
105 ~Url();
106 Url();
107
118 Url(const Url &url);
119
120
132
133
147 Url(const std::string &encodedUrl);
148
149
153 Url(Url &&other) = default;
154
155
156 // -----------------
173 static url::UrlRef
174 parseUrl(const std::string &encodedUrl);
175
176
177 // -----------------
192 Url&
193 operator = (const std::string &encodedUrl);
194
195
206 Url&
207 operator = (const Url &url);
208
209
213 Url &operator=(Url &&other) = default;
214
215
216 // -----------------
224 static bool
225 registerScheme(const std::string &scheme,
226 url::UrlRef urlImpl);
227
233 getRegisteredSchemes();
234
239 static bool
240 isRegisteredScheme(const std::string &scheme);
241
242
243 // -----------------
249 getKnownSchemes() const;
250
251
266 bool
267 isValidScheme(const std::string &scheme) const;
268
269
271 static bool schemeIsLocal( const std::string & scheme_r );
273 bool schemeIsLocal() const { return schemeIsLocal( getScheme() ); }
274
276 static bool schemeIsRemote( const std::string & scheme_r );
278 bool schemeIsRemote() const { return schemeIsRemote( getScheme() ); }
279
281 static bool schemeIsVolatile( const std::string & scheme_r );
283 bool schemeIsVolatile() const { return schemeIsVolatile( getScheme() ); }
284
286 static bool schemeIsDownloading( const std::string & scheme_r );
288 bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); }
289
291 static bool schemeIsPlugin( const std::string & scheme_r );
293 bool schemeIsPlugin() const { return schemeIsPlugin( getScheme() ); }
294
304 bool
305 isValid() const;
306
307
308 // -----------------
316 std::string
317 asString() const;
318
331 std::string
332 asString(const ViewOptions &opts) const;
333
343 std::string
344 asCompleteString() const;
345
346
347 // -----------------
352 std::string
353 getScheme() const;
354
355
356 // -----------------
366 std::string
367 getAuthority() const;
368
376 std::string
377 getUsername(EEncoding eflag = zypp::url::E_DECODED) const;
378
386 std::string
387 getPassword(EEncoding eflag = zypp::url::E_DECODED) const;
388
393 { return ! ( getUsername().empty() || getPassword().empty() ); }
394
407 std::string
408 getHost(EEncoding eflag = zypp::url::E_DECODED) const;
409
414 std::string
415 getPort() const;
416
417
418 // -----------------
428 std::string
429 getPathData() const;
430
439 std::string
440 getPathName(EEncoding eflag = zypp::url::E_DECODED) const;
441
446 std::string
447 getPathParams() const;
448
462 getPathParamsVec() const;
463
484 getPathParamsMap(EEncoding eflag = zypp::url::E_DECODED) const;
485
502 std::string
503 getPathParam(const std::string &param,
504 EEncoding eflag = zypp::url::E_DECODED) const;
505
506
507 // -----------------
517 std::string
518 getQueryString() const;
519
534 getQueryStringVec() const;
535
555 getQueryStringMap(EEncoding eflag = zypp::url::E_DECODED) const;
556
573 std::string
574 getQueryParam(const std::string &param,
575 EEncoding eflag = zypp::url::E_DECODED) const;
576
577
578 // -----------------
586 std::string
587 getFragment(EEncoding eflag = zypp::url::E_DECODED) const;
588
589
590 // -----------------
597 void
598 setScheme(const std::string &scheme);
599
600
601 // -----------------
615 void
616 setAuthority(const std::string &authority);
617
627 void
628 setUsername(const std::string &user,
630
640 void
641 setPassword(const std::string &pass,
643
664 void
665 setHost(const std::string &host);
666
674 void
675 setPort(const std::string &port);
676
677
678 // -----------------
689 void
690 setPathData(const std::string &pathdata);
691
699 void
700 setPathName(const std::string &path,
703 void
704 setPathName(const Pathname &path,
707 void
708 setPathName(const char *path,
710
714 void appendPathName( const Pathname & path_r, EEncoding eflag_r = zypp::url::E_DECODED );
715
722 void
723 setPathParams(const std::string &params);
724
731 void
732 setPathParamsVec(const zypp::url::ParamVec &pvec);
733
740 void
741 setPathParamsMap(const zypp::url::ParamMap &pmap);
742
752 void
753 setPathParam(const std::string &param, const std::string &value);
754
755
756 // -----------------
763 void
764 setQueryString(const std::string &querystr);
765
772 void
773 setQueryStringVec(const zypp::url::ParamVec &qvec);
774
781 void
782 setQueryStringMap(const zypp::url::ParamMap &qmap);
783
793 void
794 setQueryParam(const std::string &param, const std::string &value);
795
804 void
805 delQueryParam(const std::string &param);
806
807
808 // -----------------
816 void
817 setFragment(const std::string &fragment,
819
820
821 // -----------------
831 getViewOptions() const;
832
841 void
842 setViewOptions(const ViewOptions &vopts);
843
844 private:
845 friend std::string hotfix1050625::asString( const Url & url_r );
847 };
848
849 std::ostream & operator<<( std::ostream & str, const Url & url ) ZYPP_API;
850
854 bool operator<( const Url &lhs, const Url &rhs ) ZYPP_API;
855
859 bool operator==( const Url &lhs, const Url &rhs ) ZYPP_API;
860
861
862 bool operator!=( const Url &lhs, const Url &rhs ) ZYPP_API;
863
865} // namespace zypp
867
868#endif /* ZYPP_URL_H */
869/*
870** vim: set ts=2 sts=2 sw=2 ai et:
871*/
Url manipulation class.
Definition Url.h:92
bool schemeIsPlugin() const
Definition Url.h:293
bool schemeIsRemote() const
Definition Url.h:278
bool schemeIsDownloading() const
Definition Url.h:288
url::UrlRef m_impl
Definition Url.h:846
Url & operator=(Url &&other)=default
Moves the data from other into the current object.
bool schemeIsLocal() const
Definition Url.h:273
bool hasCredentialsInAuthority() const
Returns true if username and password are encoded in the authority component.
Definition Url.h:392
bool schemeIsVolatile() const
Definition Url.h:283
Url(Url &&other)=default
Move construct a Url object.
String related utilities and Regular expression matching.
std::string asString(const Url &url_r)
Definition Url.cc:890
std::vector< std::string > ParamVec
A parameter vector container.
Definition UrlUtils.h:40
ViewOption ViewOptions
ViewOptions is just an alias for ViewOption.
Definition UrlBase.h:244
std::map< std::string, std::string > ParamMap
A parameter map container.
Definition UrlUtils.h:47
std::vector< std::string > UrlSchemes
Vector of URL scheme names.
Definition UrlBase.h:251
EEncoding
Encoding flags.
Definition UrlUtils.h:52
@ E_DECODED
Flag to request decoded string(s).
Definition UrlUtils.h:54
Easy-to use interface to the ZYPP dependency resolver.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
bool operator!=(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::string asString(const Patch::Category &obj)
Definition Patch.cc:122
zypp::Url Url
Definition url.h:15
Url::asString() view options.
Definition UrlBase.h:40