Public Member Functions | Private Attributes | Static Private Attributes | List of all members
ecl::Converter< std::vector< char >, char * > Class Reference

Converts a char string of human readable hexes to a byte array. More...

#include <to_byte_array.hpp>

Inheritance diagram for ecl::Converter< std::vector< char >, char * >:
Inheritance graph
[legend]

Public Member Functions

std::vector< char > operator() (const char *input)
 
virtual ~Converter ()
 

Private Attributes

char byte
 
unsigned int state
 

Static Private Attributes

static const unsigned int waiting_first_digit = 2
 
static const unsigned int waiting_second_digit = 3
 
static const unsigned int waiting_x = 1
 
static const unsigned int waiting_zero = 0
 

Detailed Description

Converts a char string of human readable hexes to a byte array.

Parses a string of hexes into a character byte array.

See also
Converter

Definition at line 269 of file to_byte_array.hpp.

Constructor & Destructor Documentation

◆ ~Converter()

virtual ecl::Converter< std::vector< char >, char * >::~Converter ( )
inlinevirtual

Reimplemented in ecl::Converter< std::vector< char >, void >.

Definition at line 399 of file to_byte_array.hpp.

Member Function Documentation

◆ operator()()

std::vector<char> ecl::Converter< std::vector< char >, char * >::operator() ( const char *  input)
inline

Converts a string of human readable hexes into a byte array.

The string should contain bytes written as a '0x' followed by two hex digits. e.g.

0x32 0x64 0x64 0x54

This throws an exception and/or configures the error() function if an unexpected char is discovered.

Parameters
input: the character string to be converted.
Returns
vector<char> : the byte array.
Exceptions
StandardException: throws if unexpected char is discovered (debug mode only).

Definition at line 291 of file to_byte_array.hpp.

Member Data Documentation

◆ byte

char ecl::Converter< std::vector< char >, char * >::byte
private

Definition at line 405 of file to_byte_array.hpp.

◆ state

unsigned int ecl::Converter< std::vector< char >, char * >::state
private

Definition at line 404 of file to_byte_array.hpp.

◆ waiting_first_digit

const unsigned int ecl::Converter< std::vector< char >, char * >::waiting_first_digit = 2
staticprivate

Definition at line 408 of file to_byte_array.hpp.

◆ waiting_second_digit

const unsigned int ecl::Converter< std::vector< char >, char * >::waiting_second_digit = 3
staticprivate

Definition at line 409 of file to_byte_array.hpp.

◆ waiting_x

const unsigned int ecl::Converter< std::vector< char >, char * >::waiting_x = 1
staticprivate

Definition at line 407 of file to_byte_array.hpp.

◆ waiting_zero

const unsigned int ecl::Converter< std::vector< char >, char * >::waiting_zero = 0
staticprivate

Definition at line 406 of file to_byte_array.hpp.


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


ecl_converters
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:09