Url Class Reference
Class to manage URL instance. More...
#include <Url.h>
Collaboration diagram for Url:
Public Member Functions | |
Url ()=default | |
Url (const Url &url)=default | |
Url (const String &urlString) | |
Construct a URL object from a regular escaped string. More... | |
Url (const char *urlString) | |
Construct a URL object from a regular null-terminated escaped string. More... | |
Url (const String &scheme, const String &user, const String &password, const String &host, int port=0, const String &path=nullptr, const String &query=nullptr, const String &fragment=nullptr) | |
Url & | operator= (String urlString) |
Copy assignment operator. More... | |
Url & | operator= (const char *urlString) |
Copy assignment operator, for C-style strings. More... | |
String | toString () const |
Get escaped URL. More... | |
operator String () const | |
int | getPort () const |
Obtain the actual port number to be used. More... | |
String | getHostWithPort () const |
Get hostname+port part of URL string. More... | |
String | getRelativePath () const |
Get path without leading separator. More... | |
String | getPathWithQuery () const |
Get path with any query parameters attached. More... | |
String | getFileName () const |
Obtain the filename part of the URL path. More... | |
void | debugPrintTo (Print &p) const |
Printable output for debugging. More... | |
Static Public Member Functions | |
static int | getDefaultPort (const String &scheme) |
Obtain the default port for a given scheme. More... | |
Public Attributes | |
String | Scheme |
without ":" and "//" More... | |
String | User |
String | Password |
String | Host |
hostname or IP address More... | |
int | Port = 0 |
Undefined by default. More... | |
String | Path |
with leading "/" More... | |
HttpParams | Query |
String | Fragment |
Without '#'. More... | |
Detailed Description
Class to manage URL instance.
- Note
- The various URL components are stored in un-escaped format for ease of editing. Unless otherwise indicated, methods act on un-escaped text. Methods used to obtain escaped versions are clearly marked. Any attached fragment (marked bv '#') in the URL is discarded
Constructor & Destructor Documentation
◆ Url() [1/5]
|
default |
◆ Url() [2/5]
|
default |
◆ Url() [3/5]
|
inline |
Construct a URL object from a regular escaped string.
- Parameters
-
urlString Escaped URL
◆ Url() [4/5]
|
inline |
Construct a URL object from a regular null-terminated escaped string.
- Parameters
-
urlString Escaped URL
◆ Url() [5/5]
|
inline |
Member Function Documentation
◆ debugPrintTo()
◆ getDefaultPort()
|
static |
Obtain the default port for a given scheme.
- Return values
-
int 0 if scheme is not recognised or has no standard port defined
◆ getFileName()
◆ getHostWithPort()
String Url::getHostWithPort | ( | ) | const |
Get hostname+port part of URL string.
- Return values
-
String
- Note
- Neither of these is subject to escaping
◆ getPathWithQuery()
String Url::getPathWithQuery | ( | ) | const |
Get path with any query parameters attached.
- Return values
-
String
- Note
- Both path and query values are escaped
◆ getPort()
|
inline |
Obtain the actual port number to be used.
- Return values
-
int
- Note
- If not specified, the default scheme port is returned
◆ getRelativePath()
|
inline |
Get path without leading separator.
- Return values
-
String
◆ operator String()
|
inline |
◆ operator=() [1/2]
|
inline |
Copy assignment operator, for C-style strings.
- Parameters
-
urlString Escaped URL
◆ operator=() [2/2]
Copy assignment operator.
- Parameters
-
urlString Escaped URL
- Note
- urlString is modified by so no point in passing const reference
◆ toString()
Member Data Documentation
◆ Fragment
String Url::Fragment |
Without '#'.
◆ Host
String Url::Host |
hostname or IP address
◆ Password
String Url::Password |
◆ Path
String Url::Path |
with leading "/"
◆ Port
int Url::Port = 0 |
Undefined by default.
◆ Query
HttpParams Url::Query |
◆ Scheme
String Url::Scheme |
without ":" and "//"
◆ User
String Url::User |
The documentation for this class was generated from the following file: