Transfer Ease
Loading...
Searching...
No Matches
url.h
1#ifndef TEASE_NET_URL_H
2#define TEASE_NET_URL_H
3
4#include "transferease/transferease_global.h"
5
6#include <memory>
7#include <string>
8
9namespace tease
10{
11
12class TEASE_EXPORT Url
13{
14
15public:
22 {
23 SCHEME_UNK = 0,
26 SCHEME_FTPS,
35 SCHEME_NB_SUPPORTED
36 };
37
38public:
39 Url();
40 explicit Url(const std::string &url);
41
42 Url(const Url &other);
43 Url& operator=(const Url &other);
44
45 Url(Url &&other) noexcept;
46 Url& operator=(Url &&other) noexcept;
47
48 virtual ~Url();
49
50public:
51 void clear();
52 void setUrl(const std::string &url);
53
54 void setIdScheme(IdScheme idScheme);
55 void setHost(const std::string &host);
56 void setPort(uint16_t port);
57 void setPath(const std::string &path);
58
59public:
60 bool isValid() const;
61
62 std::string toString() const;
63
64 IdScheme getIdScheme() const;
65 const std::string getHost() const;
66 uint16_t getPort() const;
67 const std::string getPath() const;
68
69public:
70 static std::string idSchemeToString(IdScheme idScheme);
71 static IdScheme idSchemeFromString(const std::string &idScheme);
72
73public:
74 TEASE_EXPORT friend bool operator==(const Url &left, const Url &right);
75 TEASE_EXPORT friend bool operator!=(const Url &left, const Url &right);
76
77private:
78 class Impl;
79 std::unique_ptr<Impl> d_ptr;
80};
81
82} // namespace tease
83
84#endif // TEASE_NET_URL_H
Use to manage URLs.
Definition url.h:13
IdScheme
List of supported schemes.
Definition url.h:22
@ SCHEME_HTTP
Definition url.h:32
@ SCHEME_HTTPS
Definition url.h:33
@ SCHEME_FTP
Definition url.h:25