89ef348ef5898f0bf64317eefe8196fb48186433
[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.
42  *
43  * ex) http://user:password@www.google.co.kr:8080/market/Item?12345
44  * url_ = http://user:password@www.google.co.kr:8080/market/Item?12345
45  * scheme_ = http
46  * domain_ = user:password@www.google.co.kr
47  * port_ = 8080
48  * path_ = /market/Item?12345
49 */
50 class URL {
51  public:
52   explicit URL(const std::string& url);
53   ~URL();
54
55   std::string url() const;
56   std::string scheme() const;
57   std::string domain() const;
58   int port() const;
59   std::string path() const;
60
61  private:
62   URLImpl* impl_;
63 };
64
65 }  // namespace common
66
67 #endif  // XWALK_COMMON_URL_H_