Astarte device API for C++ 0.7.1
Astarte device SDK for C++
Loading...
Searching...
No Matches
utils Namespace Reference

Contain 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

Contain utility functions for formatting data.

Function Documentation

◆ format_base64()

template<typename OutputIt>
void 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
outReference to the output iterator where the result is written.
dataThe vector of bytes to format.

◆ format_data()

template<typename OutputIt, typename T>
void 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
outReference to the output iterator where the result is written.
dataThe element to format.

◆ format_timestamp()

template<typename OutputIt>
void 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
outReference to the output iterator where the result is written.
dataThe time_point to format.

◆ format_vector()

template<typename OutputIt, typename T>
void 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
outReference to the output iterator where the result is written.
dataThe vector to format.