222e738b66d7e0eda90fb0ac5ef7033ca16e8125
[platform/framework/web/crosswalk-tizen.git] / common / url.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd 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 #ifndef XWALK_COMMON_URL_H_
18 #define XWALK_COMMON_URL_H_
19
20 #include <string>
21
22 namespace common {
23
24 class URLImpl;
25
26 /*
27  * This class parses a given url based on its scheme type.
28  * The parsed data is stored in different variables depending on the scheme
29  * type.
30  * The following shows the variables which are used for each scheme type:
31  * http:// https:// ssh:// ftp://
32  *   => url_, scheme_, domain_, port_, path_
33  * app://
34  *   => url_, scheme_, domain_, path_
35  * file://
36  *   => url_, scheme_, path_
37  * No Scheme Type
38  *   => domain_, path_
39  *
40  * If the url does not have specific data, an empty string will be stored
41  * in the corresponding variables.(RFC 1738)
42  *
43  * ex) http://user:password@www.tizen.org:8080/market/Item?12345
44  * url_ = http://user:password@www.tizen.org:8080/market/Item?12345
45  * scheme_ = http
46  * user_ = user
47  * password_ = password
48  * domain_ = www.tizen.org
49  * port_ = 8080
50  * path_ = /market/Item?12345
51 */
52 class URL {
53  public:
54   explicit URL(const std::string& url);
55   ~URL();
56
57   std::string url() const;
58   std::string scheme() const;
59   std::string domain() const;
60   int port() const;
61   std::string path() const;
62
63  private:
64   URLImpl* impl_;
65 };
66
67 }  // namespace common
68
69 #endif  // XWALK_COMMON_URL_H_