Utility::Uri Class Reference
#include <Utility.h>
List of all members.
Detailed Description
Definition at line 78 of file Utility.h.
Constructor & Destructor Documentation
Utility::Uri::Uri |
( |
const std::string & |
url |
) |
|
Definition at line 1175 of file Utility.cpp.
References m_auth, m_ext, m_file, m_host, m_path, m_port, m_protocol, m_query_string, m_uri, m_user, and Utility::ToLower().
01175 : m_url(url), m_port(0), m_path(url)
01176 {
01177 size_t pos = url.find("://");
01178 if (pos != std::string::npos)
01179 {
01180 m_protocol = Utility::ToLower(url.substr(0, pos));
01181 m_port = (m_protocol == "http") ? 80 :
01182 (m_protocol == "https") ? 443 : 0;
01183 m_host = url.substr(pos + 3);
01184 pos = m_host.find("/");
01185 if (pos != std::string::npos)
01186 {
01187 m_path = m_host.substr(pos);
01188 m_host = m_host.substr(0, pos);
01189 }
01190 pos = m_host.find("@");
01191 if (pos != std::string::npos)
01192 {
01193 m_user = m_host.substr(0, pos);
01194 m_host = m_host.substr(pos + 1);
01195 }
01196 pos = m_user.find(":");
01197 if (pos != std::string::npos)
01198 {
01199 m_auth = m_user.substr(pos + 1);
01200 m_user = m_user.substr(0, pos);
01201 }
01202 pos = m_host.find(":");
01203 if (pos != std::string::npos)
01204 {
01205 m_port = atoi(m_host.substr(pos + 1).c_str());
01206 m_host = m_host.substr(0, pos);
01207 }
01208 }
01209 pos = m_path.find("?");
01210 if (pos != std::string::npos)
01211 {
01212 m_uri = m_path.substr(0, pos);
01213 m_query_string = m_path.substr(pos + 1);
01214 }
01215 else
01216 {
01217 m_uri = m_path;
01218 }
01219 pos = std::string::npos;
01220 for (size_t i = 0; i < m_uri.size(); ++i)
01221 if (m_uri[i] == '/')
01222 pos = i;
01223 if (pos != std::string::npos)
01224 m_file = m_uri.substr(pos + 1);
01225 pos = std::string::npos;
01226 for (size_t i = 0; i < m_uri.size(); ++i)
01227 if (m_uri[i] == '.')
01228 pos = i;
01229 if (pos != std::string::npos)
01230 m_ext = m_uri.substr(pos + 1);
01231 }
Member Function Documentation
const std::string& Utility::Uri::Url |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::UrlUri |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::QueryString |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::Protocol |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::Host |
( |
|
) |
const [inline] |
int Utility::Uri::Port |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::Path |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::File |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::Extension |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::ToString |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::User |
( |
|
) |
const [inline] |
const std::string& Utility::Uri::Auth |
( |
|
) |
const [inline] |
Member Data Documentation
The documentation for this class was generated from the following files: