10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
tenduke::net::URLCodec Class Referenceabstract

#include <URLCodec.h>

Detailed Description

URL-related coding / encoding functionality.

Inheritance diagram for tenduke::net::URLCodec:
tenduke::net::AbstractURLCodec tenduke::net::URLs tenduke::net::AbstractURLs tenduke::net::AbstractURLs tenduke::net::SimpleURLService tenduke::net::SimpleURLService tenduke::net::curl::LibCurlURLs tenduke::net::win::Win32URLs tenduke::net::curl::LibCurlURLs tenduke::net::win::Win32URLs

Public Member Functions

virtual std::string decodeURLComponent (const char *value) const =0
 Decodes URL component.
 
virtual std::string decodeURLComponent (const char *value, size_t length) const =0
 Decodes URL component.
 
virtual std::string decodeURLComponent (const std::string &value) const =0
 Decodes URL component.
 
virtual std::string encodeFormItem (const std::string &value) const =0
 Encodes a form item (name or value) for using in application/x-www-form-urlencoded payloads.
 
virtual std::string encodeURLComponent (const std::string &value) const =0
 Encodes URL component.
 
virtual std::string encodeURLPath (const std::string &value) const =0
 Encodes an entire URL path.
 
virtual std::string encodeURLQuery (const std::vector< std::pair< std::string, std::string > > &queryParameters) const =0
 Encodes URL query.
 
virtual std::string toRequestTarget (const ::tenduke::net::URL &url) const =0
 Returns "request target", i.e., string representation, which is used in an HTTP request message in the request-line (when using the origin-form).
 
virtual std::string toString (const ::tenduke::net::URL &url) const =0
 Converts the URL to string, URL encoded.
 

Member Function Documentation

◆ decodeURLComponent() [1/3]

virtual std::string tenduke::net::URLCodec::decodeURLComponent ( const char * value) const
pure virtual

Decodes URL component.

Parameters
value-
Returns
decoded string

Implemented in tenduke::net::SimpleURLService.

◆ decodeURLComponent() [2/3]

virtual std::string tenduke::net::URLCodec::decodeURLComponent ( const char * value,
size_t length ) const
pure virtual

Decodes URL component.

Parameters
value-
length-
Returns
decoded string

Implemented in tenduke::net::SimpleURLService.

◆ decodeURLComponent() [3/3]

virtual std::string tenduke::net::URLCodec::decodeURLComponent ( const std::string & value) const
pure virtual

Decodes URL component.

Parameters
value-
Returns
decoded string

Implemented in tenduke::net::SimpleURLService.

◆ encodeFormItem()

virtual std::string tenduke::net::URLCodec::encodeFormItem ( const std::string & value) const
pure virtual

Encodes a form item (name or value) for using in application/x-www-form-urlencoded payloads.

Uses rules from https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set .

Parameters
valuethe item (name or value) to encode
Returns
encoded representation of the value

Implemented in AbstractURLCodec, and tenduke::net::AbstractURLCodec.

◆ encodeURLComponent()

virtual std::string tenduke::net::URLCodec::encodeURLComponent ( const std::string & value) const
pure virtual

Encodes URL component.

Parameters
value-
Returns
encoded string

Implemented in tenduke::net::SimpleURLService.

◆ encodeURLPath()

virtual std::string tenduke::net::URLCodec::encodeURLPath ( const std::string & value) const
pure virtual

Encodes an entire URL path.

Uses rules from https://www.rfc-editor.org/rfc/rfc3986#section-3.3 to encode the path components. Path component cannot contain slashes.

For example ‘"/graph/Profile[id='abc’]/~ManyToOne/Personwould be encoded to /graph/Profile%5Bid=%27abc%27%5D/~ManyToOne/Person`.

Parameters
valuethe path to encode
Returns
URL-encoded representation of the path

Implemented in AbstractURLCodec, and tenduke::net::AbstractURLCodec.

◆ encodeURLQuery()

virtual std::string tenduke::net::URLCodec::encodeURLQuery ( const std::vector< std::pair< std::string, std::string > > & queryParameters) const
pure virtual

Encodes URL query.

Parameters
queryParameters-
Returns
URL-encoded representation of the query

Implemented in AbstractURLCodec, and tenduke::net::AbstractURLCodec.

◆ toRequestTarget()

virtual std::string tenduke::net::URLCodec::toRequestTarget ( const ::tenduke::net::URL & url) const
pure virtual

Returns "request target", i.e., string representation, which is used in an HTTP request message in the request-line (when using the origin-form).

See https://www.rfc-editor.org/rfc/rfc7230#section-3.1

Parameters
urlThe URL
Returns
the request target, URL encoded as necessary

◆ toString()

virtual std::string tenduke::net::URLCodec::toString ( const ::tenduke::net::URL & url) const
pure virtual

Converts the URL to string, URL encoded.

Parameters
urlURL to convert to string
Returns
string representation of the URL

Implemented in AbstractURLCodec, and tenduke::net::AbstractURLCodec.


The documentation for this class was generated from the following file: