1 /*
2  * Copyright 2009-2017 Alibaba Cloud All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <string>
20 #include <alibabacloud/oss/Export.h>
21 
22 namespace AlibabaCloud
23 {
24 namespace OSS
25 {
26 
27     class ALIBABACLOUD_OSS_EXPORT Url
28     {
29     public:
30         explicit Url(const std::string &url = "");
31         ~Url();
32         bool operator==(const Url &url) const;
33         bool operator!=(const Url &url) const;
34 
35         std::string authority() const;
36         void clear();
37         std::string fragment() const;
38         void fromString(const std::string &url);
39         bool hasFragment() const;
40         bool hasQuery() const;
41         std::string host()const;
42         bool isEmpty() const;
43         bool isValid() const;
44         int port()const;
45         std::string password() const;
46         std::string path() const;
47         std::string query() const;
48         std::string scheme() const;
49         void setAuthority(const std::string &authority);
50         void setFragment(const std::string &fragment);
51         void setHost(const std::string &host);
52         void setPassword(const std::string &password);
53         void setPath(const std::string &path);
54         void setPort(int port);
55         void setQuery(const std::string &query);
56         void setScheme(const std::string &scheme);
57         void setUserInfo(const std::string &userInfo);
58         void setUserName(const std::string &userName);
59         std::string toString()const;
60         std::string userInfo() const;
61         std::string userName() const;
62     private:
63         std::string scheme_;
64         std::string userName_;
65         std::string password_;
66         std::string host_;
67         std::string path_;
68         int port_;
69         std::string query_;
70         std::string fragment_;
71     };
72 }
73 }
74