Loading...
Searching...
No Matches
mqtt::buffer_view< T > Class Template Reference

`#include <buffer_view.h>`

## Public Types

using | value_type = T
using | size_type = size_t

## Public Member Functions

| buffer_view (const value_type *data, size_type n)
| buffer_view (const std::basic_string< value_type > &str)
const value_type * | data () const
size_type | size () const
size_type | length () const
const value_type & | operator[] (size_t i) const
std::basic_string< value_type > | str () const
string | to_string () const

## Detailed Description

template<typename T>
class mqtt::buffer_view< T >

A reference to a contiguous sequence of items, with no ownership. This simply contains a pointer to a const array of items, and a size. This is a similar, but simplified version of the std::string_view class(es) in the C++17 standard.

## Member Typedef Documentation

## value_type

template<typename T>

using mqtt::buffer_view< T >::value_type = T

The type of items to be held in the queue.

## size_type

template<typename T>

using mqtt::buffer_view< T >::size_type = size_t

The type used to specify number of items in the container.

## Constructor & Destructor Documentation

## buffer_view() [1/2]

template<typename T>

mqtt::buffer_view< T >::buffer_view | ( | const value_type * | data,
|  | size_type | n )

inline

Constructs a buffer view.

Parameters

  data | The data pointer
  n | The number of items

## buffer_view() [2/2]

template<typename T>

mqtt::buffer_view< T >::buffer_view | ( | const std::basic_string< value_type > & | str | ) |

inline

Constructs a buffer view to a whole string. This the starting pointer and length of the whole string.

Parameters

  str | The string.

## Member Function Documentation

## data()

template<typename T>

const value_type * mqtt::buffer_view< T >::data | ( |  | ) | const

inline

Gets a pointer the first item in the view.

Returns
  A const pointer the first item in the view.

## size()

template<typename T>

size_type mqtt::buffer_view< T >::size | ( |  | ) | const

inline

Gets the number of items in the view.

Returns
  The number of items in the view.

## length()

template<typename T>

size_type mqtt::buffer_view< T >::length | ( |  | ) | const

inline

Gets the number of items in the view.

Returns
  The number of items in the view.

## operator[]()

template<typename T>

const value_type & mqtt::buffer_view< T >::operator[] | ( | size_t | i | ) | const

inline

Access an item in the view.

Parameters

  i | The index of the item.

Returns
  A const reference to the requested item.

## str()

template<typename T>

std::basic_string< value_type > mqtt::buffer_view< T >::str | ( |  | ) | const

inline

Gets a copy of the view as a string.

Returns
  A copy of the view as a string.

## to_string()

template<typename T>

string mqtt::buffer_view< T >::to_string | ( |  | ) | const

inline

Gets a copy of the view as a string.

Returns
  A copy of the view as a string.

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

- buffer_view.h