net-cpp: core::net Namespace Reference

net-cpp .. C++11 library for networking purposes

Namespaces | Classes | Functions
core::net Namespace Reference

## Namespaces
| http

## Classes
class | Error
struct | Uri
| The Uri class encapsulates the components of a URI. More...

## Functions
CORE_NET_DLL_PUBLIC Uri | make_uri (const Uri::Host &host, const Uri::Path &path=Uri::Path(), const Uri::QueryParameters &query_parameters=Uri::QueryParameters())
| Build a URI from its components. More...

## Function Documentation

## ◆ make_uri()

CORE_NET_DLL_PUBLIC Uri core::net::make_uri | ( | const Uri::Host & | host,
|  | const Uri::Path & | path = `Uri::Path()`,
|  | const Uri::QueryParameters & | query_parameters = `Uri::QueryParameters()`
| ) |  |

Build a URI from its components.

e.g.

std::string query = "banana";
auto uri = core::net::make_uri("https://api.mydomain.com", {"api", "v3", "search"}, {{"query", query}});

When converted to a std::string with core::net::http::client::uri_to_string() the endpoint and parameters will be URL-escaped.

core::net::make_uri
CORE_NET_DLL_PUBLIC Uri make_uri(const Uri::Host &host, const Uri::Path &path=Uri::Path(), const Uri::QueryParameters &query_parameters=Uri::QueryParameters())
Build a URI from its components.