58 catch(std::exception& e)
72 std::string ss, s, login, password;
73 std::string protocol = getProtocol();
79 if(login.empty() ==
false)
81 if(password.empty() ==
false)
83 if(login.empty() ==
false || password.empty() ==
false)
87 int port = getHostPort();
93 sprintf(buf,
"%d", port);
98 if(ss.empty() ==
false)
100 ss = getQueryString();
101 if(ss.empty() ==
false)
104 ss = getFragmentString();
105 if(ss.empty() ==
false)
110 catch(std::exception& e)
120 std::string ss, s, login, password;
121 std::string protocol = getProtocol();
122 s = protocol +
"://";
127 if(login.empty() ==
false)
129 if(password.empty() ==
false)
131 if(login.empty() ==
false || password.empty() ==
false)
135 int port = getHostPort();
141 sprintf(buf,
"%d", port);
145 ss = getEncodedPathString();
146 if(ss.empty() ==
false)
148 ss = getEncodedQueryString();
149 if(ss.empty() ==
false)
152 ss = getEncodedFragmentString();
153 if(ss.empty() ==
false)
158 catch(std::exception& e)
170 catch(std::exception& e)
180 return m_uri.scheme().string();
182 catch(std::exception& e)
194 setHostPort(m_uri.authority().getDefaultPort(s));
196 catch(std::exception& e)
206 return m_uri.authority().host();
208 catch(std::exception& e)
220 std::string protocol = getProtocol();
224 catch(std::exception& e)
234 return m_uri.authority().host_type();
236 catch(std::exception& e)
246 return m_uri.authority().port();
248 catch(std::exception& e)
261 catch(std::exception& e)
271 return m_uri.authority().getLogin();
273 catch(std::exception& e)
286 catch(std::exception& e)
296 return m_uri.authority().getPassword();
298 catch(std::exception& e)
311 catch(std::exception& e)
321 return m_uri.path().string();
323 catch(std::exception& e)
333 return m_uri.path().encoding();
335 catch(std::exception& e)
348 catch(std::exception& e)
361 catch(std::exception& e)
374 catch(std::exception& e)
384 return m_uri.path().absolute();
386 catch(std::exception& e)
399 catch(std::exception& e)
409 return m_uri.path().is_directory();
411 catch(std::exception& e)
424 catch(std::exception& e)
434 return m_uri.path().empty();
436 catch(std::exception& e)
449 catch(std::exception& e)
462 catch(std::exception& e)
474 while(it != endQuery())
485 catch(std::exception& e)
495 return m_uri.query().encoding();
497 catch(std::exception& e)
510 catch(std::exception& e)
520 return m_uri.query().size();
522 catch(std::exception& e)
535 catch(std::exception& e)
546 query.push_back(std::make_pair(key, value));
548 catch(std::exception& e)
559 return query.begin();
561 catch(std::exception& e)
574 catch(std::exception& e)
585 return query.begin();
587 catch(std::exception& e)
600 catch(std::exception& e)
611 te::common::uri::query::iterator it = query.
find(key);
614 catch(std::exception& e)
625 te::common::uri::query::const_iterator it = query.
find(key);
628 catch(std::exception& e)
638 return m_uri.fragment().string();
640 catch(std::exception& e)
650 return m_uri.fragment().encoding();
652 catch(std::exception& e)
664 setEncodedFragmentString(s);
666 catch(std::exception& e)
679 catch(std::exception& e)
queryIterator endQuery()
It returns the end query iterator.
unsigned short getHostPort() const
It returns the host port.
std::string getEncodedQueryString() const
It returns the encoded query.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
void setEncodedString(const std::string &)
It sets the encoded URL string.
std::string getQueryString()
It returns the query string.
void setIsAbsolutePath(bool v)
It sets the absolute path propertie.
const std::string & getHost() const
It returns the host.
uri::path::const_iterator const_pathIterator
path const iterator type
const_pathIterator endPath() const
It returns the end const path iterator.
queryIterator beginQuery()
It returns the begin query iterator.
URI authority component (without userinfo).
std::string getPassword() const
Get password. Added by Lauro.
std::string getPathString() const
It returns the path.
const_iterator find(const std::string &key) const
Find the const_iterator for the key.
Uniform Resource Identifier (URI) reference.
void setProtocol(const std::string &s)
It sets the protocol.
uri::query::const_iterator const_queryIterator
query const iterator type
const_pathIterator beginPath() const
It returns the begin const path iterator.
std::string encode(const traits &ts, const std::string &comp)
Encode the URI (sub) component.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
void setFragmentString(const std::string &f)
It sets the fragment.
void clear()
Clear segments and reset absolute and is_directory.
URL()
Default constructor of a new URL.
uri::query::iterator queryIterator
query iterator type
std::string getEncodedPathString() const
It returns the encoded path.
bool isAbsolutePath() const
It Checks if the path is absolute.
unsigned short port() const
Get port (0 if none).
void setPassword(const std::string &password)
Set password. Added by Lauro.
void setPassword(const std::string &s)
It sets the password.
std::string getLogin() const
Get login. Added by Lauro.
void setLogin(const std::string &login)
Set login. Added by Lauro.
void setEncodedFragmentString(const std::string &f)
It sets the encoded fragment.
A helper class for URL encode/decode.
std::string getPassword() const
It returns the password.
std::string getFragmentString() const
It returns the fragment.
const std::string & getProtocol() const
It returns the protocol.
std::string getEncodedString()
It returns encoded URL string.
void setDefaultPort(const std::string &scheme)
Set Default port for the protocol. Added by Lauro.
void clearQuery()
It cleans the vector of queries.
std::string getEncodedPassword() const
Get encoded password. Added by Lauro.
void setEncodedQueryString(const std::string &query)
It sets the encoded query.
uri::authority::host_type_e getHostType() const
It returns the host type.
const_iterator end() const
Get iterator at end.
int getDefaultPort(const std::string &scheme)
Get Default port for the protocol. Added by Lauro.
std::string getString()
It returns URL string.
bool isEmptyPath() const
It Checks if the path is empty.
std::string getEncodedLogin() const
Get endoded login. Added by Lauro.
te::common::URL::queryIterator findQueryKey(const std::string &key)
it finds the key and return query iterator.
std::string getEncodedFragmentString() const
It returns encoded the fragment.
int getQuerySize() const
It returns the query size.
const_iterator begin() const
Get iterator at beginning.
void addQuery(const std::string &key, const std::string &value)
It cleans the vector of queries.
bool is_directory() const
Test if a directory, meaning the path ends in a "/".
std::string getLogin() const
It returns the login.
void clearPath()
It cleans the path.
void setEncodedPathString(const std::string &path)
It sets the encoded path.
A class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web...
void addPath(const std::string &p)
It adds the path.
bool absolute() const
Test if absolute, meaning path begins with "/".
This class is designed for dealing with multi-language text translation in TerraLib.
void setIsDirectoryPath(bool v)
It sets the directory path propertie.
const traits FRAGMENT_TRAITS
fragment traits
bool isDirectoryPath() const
It Checks if the path is directory.
void setHost(const std::string &s)
It sets the host.
void setLogin(const std::string &s)
It sets the login.
void setHostPort(unsigned short p)
It sets the host port.