restinio::router::impl::target_path_holder_t Class Reference

Helper class for holding a unique instance of char array with target_path value. More...

`#include <target_path_holder.hpp>`

## Public Types

using | data_t = std::unique_ptr< char[]>

## Public Member Functions

| target_path_holder_t (string_view_t original_path)
| Initializing constructor. More...
RESTINIO_NODISCARD string_view_t | view () const noexcept
| Get access to the value of target_path. More...
RESTINIO_NODISCARD data_t | giveout_data () noexcept
| Give out the value from holder. More...

## Private Attributes

data_t | m_data
| Actual data with target_path. More...
std::size_t | m_size
| The length of target_path. More...

## Detailed Description

Helper class for holding a unique instance of char array with target_path value.

This class is a kind of std::unique_ptr<char[]> but it performs the normalization of target_path value in the constructor. All percent-encoded characters from unreserved set will be decoded into their normal representation. It means that target_path `/%7Etest` will be automatically transformed into `/~test`.

Since
  v.0.6.2

Definition at line 45 of file target_path_holder.hpp.

## Member Typedef Documentation

## data_t

using restinio::router::impl::target_path_holder_t::data_t = std::unique_ptr<char[]>

Definition at line 48 of file target_path_holder.hpp.

## Constructor & Destructor Documentation

## target_path_holder_t()

restinio::router::impl::target_path_holder_t::target_path_holder_t | ( | string_view_t | original_path | ) |

inline

Initializing constructor.

Copies the value of original_path into a unique and dynamically allocated array of chars.

Basic URI normalization procedure is automatically performed if necessary.

Note
  Can throws if allocation of new data buffer fails or if original_path has an invalid format.

Definition at line 62 of file target_path_holder.hpp.

## Member Function Documentation

## giveout_data()

RESTINIO_NODISCARD data_t restinio::router::impl::target_path_holder_t::giveout_data | ( |  | ) |

inline noexcept

Give out the value from holder.

Attention
  The holder becomes empty after the return from that method and should not be used anymore.

Definition at line 99 of file target_path_holder.hpp.

## view()

RESTINIO_NODISCARD string_view_t restinio::router::impl::target_path_holder_t::view | ( |  | ) | const

inline noexcept

Get access to the value of target_path.

Attention
  This method should not be called after a call to giveout_data().

Definition at line 86 of file target_path_holder.hpp.

## Member Data Documentation

## m_data

data_t restinio::router::impl::target_path_holder_t::m_data

private

Actual data with target_path.

Note
  It becomes empty after a call to giveout_data().

Definition at line 110 of file target_path_holder.hpp.

## m_size

std::size_t restinio::router::impl::target_path_holder_t::m_size

private

The length of target_path.

Definition at line 112 of file target_path_holder.hpp.

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

- restinio/router/impl/target_path_holder.hpp