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

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

#include <formatters.hpp>

List of all members.

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) ecl_assert_throw_decl(StandardException)
 Formats on a window of the array.
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) ecl_assert_throw_decl(StandardException)

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

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.

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

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


Member Function Documentation

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.

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.

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

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

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.

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.

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 Wed Aug 26 2015 11:27:29