Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Private Member Functions | Private Attributes | List of all members
HexPuller< CharPuller > Class Template Reference

#include <MIDI_Parsers/HexPuller.hpp>

Detailed Description

template<class CharPuller>
class HexPuller< CharPuller >

Class that parses hexadecimal ASCII text to bytes.

For example, parses the string "7f A 123456" to the bytes {0x7F, 0x0A, 0x12, 0x34, 0x56}.

Template Parameters
CharPullerClass that supplies the ASCII characters to parse.
See also
BufferPuller
StreamPuller

Definition at line 25 of file HexPuller.hpp.

+ Collaboration diagram for HexPuller< CharPuller >:

Public Member Functions

 HexPuller (CharPuller &&puller)
 
bool pull (uint8_t &output)
 Pull out a new byte.
 

Public Attributes

CharPuller puller
 

Static Private Member Functions

static uint8_t hex2int (char hex)
 Convert a hexadecimal character to a 4-bit nibble.
 

Private Attributes

char char1 = '\0'
 
char char2 = '\0'
 

Constructor & Destructor Documentation

◆ HexPuller()

template<class CharPuller >
HexPuller ( CharPuller && puller)
inline

Definition at line 27 of file HexPuller.hpp.

Member Function Documentation

◆ pull()

template<class CharPuller >
bool pull ( uint8_t & output)
inline

Pull out a new byte.

Pulls characters from the CharPuller until a hexadecimal number was found, decodes it, and returns it.

Parameters
[out]outputA new byte (if available).
Returns
True if a byte was available, false otherwise.

Definition at line 35 of file HexPuller.hpp.

◆ hex2int()

template<class CharPuller >
static uint8_t hex2int ( char hex)
inlinestaticprivate

Convert a hexadecimal character to a 4-bit nibble.

Definition at line 61 of file HexPuller.hpp.

Member Data Documentation

◆ puller

template<class CharPuller >
CharPuller puller

Definition at line 66 of file HexPuller.hpp.

◆ char1

template<class CharPuller >
char char1 = '\0'
private

Definition at line 69 of file HexPuller.hpp.

◆ char2

template<class CharPuller >
char char2 = '\0'
private

Definition at line 70 of file HexPuller.hpp.


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