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(Url &&other) noexcept;
44
45 virtual ~Url();
46
47public:
48 void clear();
49 void setUrl(const std::string &url);
50
51 void setIdScheme(IdScheme idScheme);
52 void setHost(const std::string &host);
53 void setPort(uint16_t port);
54 void setPath(const std::string &path);
55
56public:
57 bool isValid() const;
58
59 std::string toString() const;
60
61 IdScheme getIdScheme() const;
62 const std::string& getHost() const;
63 uint16_t getPort() const;
64 const std::string& getPath() const;
65
66public:
67 static std::string idSchemeToString(IdScheme idScheme);
68 static IdScheme idSchemeFromString(const std::string &idScheme);
69
70public:
71 Url& operator=(const Url &other);
72 Url& operator=(Url &&other) noexcept;
73
74public:
75 TEASE_EXPORT friend bool operator==(const Url &left, const Url &right);
76 TEASE_EXPORT friend bool operator!=(const Url &left, const Url &right);
77
78private:
79 class Impl;
80 std::unique_ptr<Impl> d_ptr;
81};
82
83} // namespace tease
84
85#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