libzypp: zypp-core/Url.h Source File

libzypp 17.36.6

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 <set>
16#include <zypp-core/url/UrlBase.h>
17#include <zypp-core/url/UrlUtils.h>
18
19
21namespace zypp
22{
23
24 class Url;
25 namespace hotfix1050625 {
26 std::string asString( const Url & url_r );
27 }
28 namespace filesystem {
29 class Pathname;
30 }
31 using filesystem::Pathname;
32
92 class ZYPP_API Url
93 {
94 public:
98 using EEncoding = zypp::url::EEncoding;
99
103 using ViewOptions = zypp::url::ViewOptions;
104
105
106 ~Url();
107 Url();
108
119 Url(const Url &url);
120
121
132 Url(zypp::url::UrlRef url);
133
134
148 Url(const std::string &encodedUrl);
149
150
154 Url(Url &&other) = default;
155
156
157 // -----------------
174 static url::UrlRef
175 parseUrl(const std::string &encodedUrl);
176
177
178 // -----------------
193 Url&
194 operator = (const std::string &encodedUrl);
195
196
207 Url&
208 operator = (const Url &url);
209
210
214 Url &operator=(Url &&other) = default;
215
216
217 // -----------------
225 static bool
226 registerScheme(const std::string &scheme,
227 url::UrlRef urlImpl);
228
233 static zypp::url::UrlSchemes
234 getRegisteredSchemes();
235
240 static bool
241 isRegisteredScheme(const std::string &scheme);
242
243
244 // -----------------
249 zypp::url::UrlSchemes
250 getKnownSchemes() const;
251
252
267 bool
268 isValidScheme(const std::string &scheme) const;
269
270
272 static bool schemeIsLocal( const std::string & scheme_r );
274 bool schemeIsLocal() const { return schemeIsLocal( getScheme() ); }
275
277 static bool schemeIsRemote( const std::string & scheme_r );
279 bool schemeIsRemote() const { return schemeIsRemote( getScheme() ); }
280
282 static bool schemeIsVolatile( const std::string & scheme_r );
284 bool schemeIsVolatile() const { return schemeIsVolatile( getScheme() ); }
285
287 static bool schemeIsDownloading( const std::string & scheme_r );
289 bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); }
290
292 static bool schemeIsPlugin( const std::string & scheme_r );
294 bool schemeIsPlugin() const { return schemeIsPlugin( getScheme() ); }
295
305 bool
306 isValid() const;
307
308
309 // -----------------
317 std::string
318 asString() const;
319
332 std::string
333 asString(const ViewOptions &opts) const;
334
344 std::string
345 asCompleteString() const;
346
347
348 // -----------------
353 std::string
354 getScheme() const;
355
356
357 // -----------------
367 std::string
368 getAuthority() const;
369
377 std::string
378 getUsername(EEncoding eflag = zypp::url::E_DECODED) const;
379
387 std::string
388 getPassword(EEncoding eflag = zypp::url::E_DECODED) const;
389
393 bool hasCredentialsInAuthority() const
394 { return ! ( getUsername().empty() || getPassword().empty() ); }
395
408 std::string
409 getHost(EEncoding eflag = zypp::url::E_DECODED) const;
410
415 std::string
416 getPort() const;
417
418
419 // -----------------
429 std::string
430 getPathData() const;
431
440 std::string
441 getPathName(EEncoding eflag = zypp::url::E_DECODED) const;
442
447 std::string
448 getPathParams() const;
449
462 zypp::url::ParamVec
463 getPathParamsVec() const;
464
484 zypp::url::ParamMap
485 getPathParamsMap(EEncoding eflag = zypp::url::E_DECODED) const;
486
503 std::string
504 getPathParam(const std::string &param,
505 EEncoding eflag = zypp::url::E_DECODED) const;
506
507
508 // -----------------
518 std::string
519 getQueryString() const;
520
534 zypp::url::ParamVec
535 getQueryStringVec() const;
536
555 zypp::url::ParamMap
556 getQueryStringMap(EEncoding eflag = zypp::url::E_DECODED) const;
557
574 std::string
575 getQueryParam(const std::string &param,
576 EEncoding eflag = zypp::url::E_DECODED) const;
577
578
579 // -----------------
587 std::string
588 getFragment(EEncoding eflag = zypp::url::E_DECODED) const;
589
590
591 // -----------------
598 void
599 setScheme(const std::string &scheme);
600
601
602 // -----------------
616 void
617 setAuthority(const std::string &authority);
618
628 void
629 setUsername(const std::string &user,
630 EEncoding eflag = zypp::url::E_DECODED);
631
641 void
642 setPassword(const std::string &pass,
643 EEncoding eflag = zypp::url::E_DECODED);
644
665 void
666 setHost(const std::string &host);
667
675 void
676 setPort(const std::string &port);
677
678
679 // -----------------
690 void
691 setPathData(const std::string &pathdata);
692
700 void
701 setPathName(const std::string &path,
702 EEncoding eflag = zypp::url::E_DECODED);
704 void
705 setPathName(const Pathname &path,
706 EEncoding eflag = zypp::url::E_DECODED);
708 void
709 setPathName(const char *path,
710 EEncoding eflag = zypp::url::E_DECODED);
711
715 void appendPathName( const Pathname & path_r, EEncoding eflag_r = zypp::url::E_DECODED );
716
723 void
724 setPathParams(const std::string &params);
725
732 void
733 setPathParamsVec(const zypp::url::ParamVec &pvec);
734
741 void
742 setPathParamsMap(const zypp::url::ParamMap &pmap);
743
753 void
754 setPathParam(const std::string &param, const std::string &value);
755
756
757 // -----------------
764 void
765 setQueryString(const std::string &querystr);
766
773 void
774 setQueryStringVec(const zypp::url::ParamVec &qvec);
775
782 void
783 setQueryStringMap(const zypp::url::ParamMap &qmap);
784
794 void
795 setQueryParam(const std::string &param, const std::string &value);
796
805 void
806 delQueryParam(const std::string &param);
807
809 void
810 delQueryParams(const std::set<std::string> &params);
811
812
813 // -----------------
821 void
822 setFragment(const std::string &fragment,
823 EEncoding eflag = zypp::url::E_DECODED);
824
825
826 // -----------------
835 ViewOptions
836 getViewOptions() const;
837
846 void
847 setViewOptions(const ViewOptions &vopts);
848
849 private:
850 friend std::string hotfix1050625::asString( const Url & url_r );
851 url::UrlRef m_impl;
852 };
853
854 std::ostream & operator<<( std::ostream & str, const Url & url ) ZYPP_API;
855
859 bool operator<( const Url &lhs, const Url &rhs ) ZYPP_API;
860
864 bool operator==( const Url &lhs, const Url &rhs ) ZYPP_API;
865
866
867 bool operator!=( const Url &lhs, const Url &rhs ) ZYPP_API;
868
870} // namespace zypp
872
873#endif /* ZYPP_URL_H */
874/*
875** vim: set ts=2 sts=2 sw=2 ai et:
876*/
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::Url::schemeIsPlugin
bool schemeIsPlugin() const
Definition Url.h:294
zypp::Url::getScheme
std::string getScheme() const
Returns the scheme name of the URL.
Definition Url.cc:551
zypp::Url::ViewOptions
zypp::url::ViewOptions ViewOptions
View options.
Definition Url.h:103
zypp::Url::schemeIsRemote
bool schemeIsRemote() const
Definition Url.h:279
zypp::Url::getUsername
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.
Definition Url.cc:590
zypp::Url::isRegisteredScheme
static bool isRegisteredScheme(const std::string &scheme)
Returns if scheme name is registered.
Definition Url.cc:442
zypp::Url::Url
Url()
Definition Url.cc:306
zypp::Url::schemeIsDownloading
bool schemeIsDownloading() const
Definition Url.h:289
zypp::Url::m_impl
url::UrlRef m_impl
Definition Url.h:851
zypp::Url::schemeIsLocal
static bool schemeIsLocal(const std::string &scheme_r)
hd cd dvd dir file iso
Definition Url.cc:475
zypp::Url::parseUrl
static url::UrlRef parseUrl(const std::string &encodedUrl)
Parse a percent-encoded URL string.
Definition Url.cc:389
zypp::Url::operator=
Url & operator=(Url &&other)=default
Moves the data from other into the current object.
zypp::Url::EEncoding
zypp::url::EEncoding EEncoding
Encoding flags.
Definition Url.h:98
zypp::Url::registerScheme
static bool registerScheme(const std::string &scheme, url::UrlRef urlImpl)
Register a scheme-specific implementation.
Definition Url.cc:379
zypp::Url::isValidScheme
bool isValidScheme(const std::string &scheme) const
Verifies the specified scheme name.
Definition Url.cc:458
zypp::Url::getRegisteredSchemes
static zypp::url::UrlSchemes getRegisteredSchemes()
Returns all registered scheme names.
Definition Url.cc:433
zypp::Url::schemeIsLocal
bool schemeIsLocal() const
Definition Url.h:274
zypp::Url::getKnownSchemes
zypp::url::UrlSchemes getKnownSchemes() const
Returns scheme names known to this object.
Definition Url.cc:450
zypp::Url::hasCredentialsInAuthority
bool hasCredentialsInAuthority() const
Returns true if username and password are encoded in the authority component.
Definition Url.h:393
zypp::Url::getPassword
std::string getPassword(EEncoding eflag=zypp::url::E_DECODED) const
Returns the password from the URL authority.
Definition Url.cc:598
zypp::Url::schemeIsVolatile
bool schemeIsVolatile() const
Definition Url.h:284
zypp::Url::Url
Url(Url &&other)=default
Move construct a Url object.
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
str
String related utilities and Regular expression matching.
zypp::filesystem
Types and functions for filesystem operations.
Definition Glob.cc:24
zypp::hotfix1050625
Definition Url.cc:931
zypp::hotfix1050625::asString
std::string asString(const Url &url_r)
Definition Url.cc:932
zypp::url
Url details namespace.
Definition UrlBase.cc:58
zypp::url::UrlRef
RWCOW_pointer< UrlBase > UrlRef
Copy-On-Write Url reference.
Definition UrlBase.h:1093
zypp::url::ParamVec
std::vector< std::string > ParamVec
A parameter vector container.
Definition UrlUtils.h:40
zypp::url::ViewOptions
ViewOption ViewOptions
ViewOptions is just an alias for ViewOption.
Definition UrlBase.h:245
zypp::url::ParamMap
std::map< std::string, std::string > ParamMap
A parameter map container.
Definition UrlUtils.h:47
zypp::url::UrlSchemes
std::vector< std::string > UrlSchemes
Vector of URL scheme names.
Definition UrlBase.h:252
zypp::url::EEncoding
EEncoding
Encoding flags.
Definition UrlUtils.h:52
zypp::url::E_DECODED
@ E_DECODED
Flag to request decoded string(s).
Definition UrlUtils.h:54
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::operator<
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
Definition StrMatcher.cc:340
zypp::operator==
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...
Definition SetRelationMixin.h:84
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::operator!=
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...
Definition SetRelationMixin.h:109
zypp::asString
std::string asString(const Patch::Category &obj)
Definition Patch.cc:122
UrlBase.h
UrlUtils.h