10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
tenduke::net::AbstractURLCodec Class Reference

#include <AbstractURLCodec.h>

Detailed Description

Base implementation of tenduke::net::URLCodec which provides base functionality and can be subclassed to provide specific implementations for the encoding / decoding of URL components.

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

Public Member Functions

std::string encodeFormItem (const std::string &value) const override
 Encodes a form item (name or value) for using in application/x-www-form-urlencoded payloads.
 
std::string encodeURLPath (const std::string &value) const override
 Encodes an entire URL path.
 
std::string encodeURLQuery (const std::vector< std::pair< std::string, std::string > > &queryParameters) const override
 Encodes URL query.
 
std::string toRequestTarget (const tenduke::net::URL &url) const override
 
std::string toString (const ::tenduke::net::URL &url) const override
 Converts the URL to string, URL encoded.
 
- Public Member Functions inherited from tenduke::net::URLCodec
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 encodeURLComponent (const std::string &value) const =0
 Encodes URL component.
 
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).
 

Member Function Documentation

◆ encodeFormItem()

std::string tenduke::net::AbstractURLCodec::encodeFormItem ( const std::string & value) const
overridevirtual

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

Implements tenduke::net::URLCodec.

◆ encodeURLPath()

std::string tenduke::net::AbstractURLCodec::encodeURLPath ( const std::string & value) const
overridevirtual

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

Implements tenduke::net::URLCodec.

◆ encodeURLQuery()

std::string tenduke::net::AbstractURLCodec::encodeURLQuery ( const std::vector< std::pair< std::string, std::string > > & queryParameters) const
overridevirtual

Encodes URL query.

Parameters
queryParameters-
Returns
URL-encoded representation of the query

Implements tenduke::net::URLCodec.

◆ toString()

std::string tenduke::net::AbstractURLCodec::toString ( const ::tenduke::net::URL & url) const
overridevirtual

Converts the URL to string, URL encoded.

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

Implements tenduke::net::URLCodec.


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