Hyper API for C++  0.0.16638
Hyper client library for C++ applications
hyperapi::ByteSpan Struct Reference

An arbitrarily-sized binary value. More...

#include <ByteSpan.hpp>

Public Member Functions

 ByteSpan (const uint8_t *data, size_t size) noexcept
 Constructor.
 
 ByteSpan (const std::vector< uint8_t > &bytes) noexcept
 Constructor.
 
std::string toString () const
 Returns a string representation of the binary data. More...
 

Public Attributes

const uint8_t * data
 The start of the binary data.
 
size_t size
 The size of the data.
 

Friends

bool operator== (const ByteSpan &lhs, const ByteSpan &rhs) noexcept
 Equality operator.
 
bool operator> (const ByteSpan &lhs, const ByteSpan &rhs) noexcept
 Greater operator.
 
bool operator!= (const ByteSpan &a, const ByteSpan &b) noexcept
 Not equal operator.
 
bool operator< (const ByteSpan &a, const ByteSpan &b) noexcept
 Less than operator.
 
bool operator<= (const ByteSpan &a, const ByteSpan &b) noexcept
 Less than or equal operator.
 
bool operator>= (const ByteSpan &a, const ByteSpan &b) noexcept
 Greater or equal operator.
 
std::ostream & operator<< (std::ostream &os, const ByteSpan &obj)
 Stream output operator.
 

Detailed Description

An arbitrarily-sized binary value.

Definition at line 20 of file ByteSpan.hpp.

Member Function Documentation

◆ toString()

std::string hyperapi::ByteSpan::toString ( ) const

Returns a string representation of the binary data.

The binary data is printed byte-wise. All printable bytes (according to std::isprint()) are printed as is. All other bytes are printed as escaped hexadecimal characters (e.g.: \\x04).

Returns
a string representation of the binary data.

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