nlib
nn::nlib::UriQueryEncoder< N > Class Template Referencefinal

The class for creating URI queries. More...

#include "nn/nlib/Uri.h"

Public Member Functions

 UriQueryEncoder () noexcept
 Instantiates the object with default parameters (default constructor).
 
errno_t Append (const char *key, const char *value) noexcept
 Encodes a provided pair of a key and value and appends it to the query string. More...
 
const char * c_str () const noexcept
 Returns the encoded query string.
 
 operator const char * () const noexcept
 Returns the encoded query string.
 
std::pair< const char *, const char * > GetData () const noexcept
 Returns the beginning and end of the encoded query string.
 

Detailed Description

template<size_t N = 1024>
class nn::nlib::UriQueryEncoder< N >

The class for creating URI queries.

Template Parameters
NThe size of the buffer to store the encoded query string.
Description
Receives a string containing a key and value and encodes it into a query string. The query string can be also set by passing the encoded string to the Uri::SetQuery() function. The size of the internal buffer can be specified using the template parameter.
Examples:
misc/uri/uri.cpp.

Definition at line 32 of file Uri.h.

Member Function Documentation

◆ Append()

template<size_t N>
errno_t nn::nlib::UriQueryEncoder< N >::Append ( const char *  key,
const char *  value 
)
noexcept

Encodes a provided pair of a key and value and appends it to the query string.

Parameters
[in]keyQuery string key.
[in]valueQuery string value.
Return values
0Success.
ERANGEInsufficient buffer size.
Description
If NULL is passed to the argument, it is assumed that an empty key and/or an empty value has been set. If not successful, the query string stays in the state that has been maintained until this function was executed.

Definition at line 320 of file Uri.h.


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