00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2004-2006, 2008 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see 00017 // <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #ifndef LIBAEGIS_URL_H 00021 #define LIBAEGIS_URL_H 00022 00023 #include <common/nstring.h> 00024 00028 class url 00029 { 00030 public: 00034 virtual ~url(); 00035 00042 url(const nstring &s); 00043 00050 url(const char *s); 00051 00055 url(const url &); 00056 00060 url &operator=(const url &); 00061 00069 void split(const char *s); 00070 00079 bool is_a_file() const; 00080 00085 nstring get_path() const; 00086 00091 void set_path_if_empty(const nstring &dflt); 00092 00097 void set_query_if_empty(const nstring &dflt); 00098 00107 nstring reassemble(bool exclude_userpass = false) const; 00108 00116 void set_host_part_from(const url &arg); 00117 00122 nstring get_protocol() const { return protocol; } 00123 00128 nstring get_userpass() const { return userpass; } 00129 00134 nstring get_hostname() const { return hostname; } 00135 00140 int get_port() const { return port; } 00141 00142 private: 00147 nstring protocol; 00148 00153 nstring userpass; 00154 00159 nstring hostname; 00160 00165 int port; 00166 00171 nstring path; 00172 00177 nstring query; 00178 00183 nstring anchor_name; 00184 00188 url(); 00189 }; 00190 00191 #endif // LIBAEGIS_URL_H