Astarte device API for C++ 0.8.1
Astarte device SDK for C++
Loading...
Searching...
No Matches
astarte::device::utils Namespace Reference

Utility functions for formatting data. More...

Functions

template<typename OutputIt>
void format_base64 (OutputIt &out, const std::vector< uint8_t > &data)
 Format a vector of bytes into a Base64 string literal.
 
template<typename OutputIt>
void format_timestamp (OutputIt &out, const std::chrono::system_clock::time_point &data)
 Format a timestamp into an ISO 8601 string literal.
 
template<typename OutputIt, typename T>
void format_data (OutputIt &out, const T &data)
 Format a generic data type into an output iterator.
 
template<typename OutputIt, typename T>
void format_vector (OutputIt &out, const std::vector< T > &data)
 Format a generic vector into a comma-separated list in brackets.
 

Detailed Description

Utility functions for formatting data.

Function Documentation

◆ format_base64()

template<typename OutputIt>
void astarte::device::utils::format_base64 ( OutputIt & out,
const std::vector< uint8_t > & data )

Format a vector of bytes into a Base64 string literal.

Template Parameters
OutputItThe type of the output iterator.
Parameters
[in,out]outReference to the output iterator where the result is written.
[in]dataThe vector of bytes to format.

◆ format_data()

template<typename OutputIt, typename T>
void astarte::device::utils::format_data ( OutputIt & out,
const T & data )

Format a generic data type into an output iterator.

Template Parameters
OutputItThe type of the output iterator.
TThe type of the element.
Parameters
[in,out]outReference to the output iterator where the result is written.
[in]dataThe element to format.

◆ format_timestamp()

template<typename OutputIt>
void astarte::device::utils::format_timestamp ( OutputIt & out,
const std::chrono::system_clock::time_point & data )

Format a timestamp into an ISO 8601 string literal.

Template Parameters
OutputItThe type of the output iterator.
Parameters
[in,out]outReference to the output iterator where the result is written.
[in]dataThe time_point to format.

◆ format_vector()

template<typename OutputIt, typename T>
void astarte::device::utils::format_vector ( OutputIt & out,
const std::vector< T > & data )

Format a generic vector into a comma-separated list in brackets.

Template Parameters
OutputItThe type of the output iterator.
TThe type of elements in the vector.
Parameters
[in,out]outReference to the output iterator where the result is written.
[in]dataThe vector to format.