Public Member Functions | Private Attributes | Friends | List of all members
ecl::formatters::ByteArrayFormatter< Byte, N > Class Template Reference

Parent template for the byte array formatters. More...

#include <formatters.hpp>

Public Member Functions

 ByteArrayFormatter ()
 
ByteArrayFormatter< Byte, N > & operator() (const Array< Byte, N > &array)
 
ByteArrayFormatter< Byte, N > & operator() (const Stencil< Array< Byte, N > > &stencil)
 
ByteArrayFormatter< Byte, N > & operator() (typename Array< Byte, N >::const_iterator begin_iter, typename Array< Byte, N >::const_iterator end_iter)
 Formats on a window of the array. More...
 
virtual ~ByteArrayFormatter ()
 

Private Attributes

Array< Byte, N >::const_iterator begin_iterator
 
Array< Byte, N >::const_iterator end_iterator
 
bool ready_to_format
 

Friends

template<typename OutputStream , typename CharType , size_t M>
OutputStream & operator<< (OutputStream &ostream, const ByteArrayFormatter< CharType, M > &formatter)
 

Detailed Description

template<typename Byte, size_t N>
class ecl::formatters::ByteArrayFormatter< Byte, N >

Parent template for the byte array formatters.

We dont accept arguments for this class, it is simply designed to present byte arrays in hex format byte by byte. If you want specialised formatting for the character array, iterate over it with the Format<char> (or signed/unsigned char) class.

It will also accept stencils which have an underlying array of the required type.

Do not use this class directly, rather call it via either the Array or Format classes explicitly. This makes the code more readable. e.g.

Array<char>::Formatter format_array_1;
Format< Array<char,4> > format_array_2; // same thing
Template Parameters
Byte: byte type, signed char/char/unsigned char.
N: the size of the container to be formatted.

Definition at line 107 of file array/formatters.hpp.

Constructor & Destructor Documentation

◆ ByteArrayFormatter()

template<typename Byte, size_t N>
ecl::formatters::ByteArrayFormatter< Byte, N >::ByteArrayFormatter ( )
inline

Default constructor that simply sets up the formatter for use. There is only one formatting style for this - a byte by byte view of the array in hex format, so we don't accept any arguments. If you want specialised formatting for your array, iterate it element by element with the Format<signed char> class.

Definition at line 117 of file array/formatters.hpp.

◆ ~ByteArrayFormatter()

template<typename Byte, size_t N>
virtual ecl::formatters::ByteArrayFormatter< Byte, N >::~ByteArrayFormatter ( )
inlinevirtual

Definition at line 169 of file array/formatters.hpp.

Member Function Documentation

◆ operator()() [1/3]

template<typename Byte, size_t N>
ByteArrayFormatter<Byte,N>& ecl::formatters::ByteArrayFormatter< Byte, N >::operator() ( const Array< Byte, N > &  array)
inline

The format operator. Use this when inserting into a stream. It returns a template on which the stream will perform the formatting to create the requested output.

Parameters
array: the array to format.
Returns
Format<Array<signed char,N>>& : this formatter readied for use by a stream.

Definition at line 126 of file array/formatters.hpp.

◆ operator()() [2/3]

template<typename Byte, size_t N>
ByteArrayFormatter<Byte,N>& ecl::formatters::ByteArrayFormatter< Byte, N >::operator() ( const Stencil< Array< Byte, N > > &  stencil)
inline

The format operator. Use this when inserting into a stream. It returns a template on which the stream will perform the formatting to create the requested output.

Parameters
stencil: a stencil on an underlying array of the requisite type.
Returns
Format< Array<signed char,N>>& : this formatter readied for use by a stream.

Definition at line 140 of file array/formatters.hpp.

◆ operator()() [3/3]

template<typename Byte, size_t N>
ByteArrayFormatter<Byte,N>& ecl::formatters::ByteArrayFormatter< Byte, N >::operator() ( typename Array< Byte, N >::const_iterator  begin_iter,
typename Array< Byte, N >::const_iterator  end_iter 
)
inline

Formats on a window of the array.

Format over the window specified.

Parameters
begin_iter: point in the array to begin formatting from.
end_iter: point in the array to begin formatting to.
Returns
Format<Array<signed char,N>>& : this formatter readied for use by a stream.
Exceptions
StandardException: throws if indices are out of range [debug mode only].

Definition at line 158 of file array/formatters.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename Byte, size_t N>
template<typename OutputStream , typename CharType , size_t M>
OutputStream& operator<< ( OutputStream &  ostream,
const ByteArrayFormatter< CharType, M > &  formatter 
)
friend

Insertion operator for sending the formatter (for character arrays) to an output stream.

Template Parameters
OutputStream: the type of the output stream to be inserted into.
M: the size of the container to be formatted.
Parameters
ostream: the output stream.
formatter: the formatter to be inserted.
Returns
OutputStream : continue streaming with the updated output stream.
Exceptions
StandardException: throws if the formatter is used multiply in one stream operation [debug mode only].

Definition at line 195 of file array/formatters.hpp.

Member Data Documentation

◆ begin_iterator

template<typename Byte, size_t N>
Array<Byte,N>::const_iterator ecl::formatters::ByteArrayFormatter< Byte, N >::begin_iterator
private

Definition at line 185 of file array/formatters.hpp.

◆ end_iterator

template<typename Byte, size_t N>
Array<Byte,N>::const_iterator ecl::formatters::ByteArrayFormatter< Byte, N >::end_iterator
private

Definition at line 186 of file array/formatters.hpp.

◆ ready_to_format

template<typename Byte, size_t N>
bool ecl::formatters::ByteArrayFormatter< Byte, N >::ready_to_format
private

Definition at line 187 of file array/formatters.hpp.


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


ecl_containers
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:43