EmBencode
Implementation of the Bencode serialisation format for embedded microcontrollers.
 All Classes Files Functions Pages
EmBencode Class Reference

Encoder class to generate Bencode on the fly (no buffer storage needed). More...

#include <EmBencode.h>

Static Public Member Functions

static void push (const char *str)
 Push a string out in Bencode format. More...
 
static void push (const void *ptr, uint8_t len)
 Push arbitrary bytes in Bencode format. More...
 
static void push (long val)
 Push a signed integer in Bencode format. More...
 
static void startList ()
 Start a new new list. More...
 
static void endList ()
 Terminate a list, started earlier with a call to startList().
 
static void startDict ()
 Start a new new dictionary. More...
 
static void endDict ()
 Terminate a dictionary, started earlier with a call to startDict().
 

Static Protected Member Functions

static void PushCount (uint32_t num)
 
static void PushEnd ()
 
static void PushData (const void *ptr, uint8_t len)
 
static void PushChar (char ch)
 This function is not implemented in the library. More...
 

Detailed Description

Encoder class to generate Bencode on the fly (no buffer storage needed).

Member Function Documentation

static void EmBencode::push ( const char *  str)
inlinestatic

Push a string out in Bencode format.

Parameters
strThe zero-terminated string to send out (without trailing \0).
static void EmBencode::push ( const void *  ptr,
uint8_t  len 
)
inlinestatic

Push arbitrary bytes in Bencode format.

Parameters
ptrPointer to the data to send out.
lenNumber of data bytes to send out.
static void EmBencode::push ( long  val)
inlinestatic

Push a signed integer in Bencode format.

Parameters
valThe integer to send (this implementation supports 32 bits).
void EmBencode::PushChar ( char  ch)
staticprotected

This function is not implemented in the library.

It must be supplied by the caller to implement the actual writing of caharacters.

static void EmBencode::startDict ( )
inlinestatic

Start a new new dictionary.

Must be matched with a call to endDict(). Dictionary entries must consist of a string key plus an arbitrary value. Entries can be nested with more calls to startList(), startDict(), etc.

static void EmBencode::startList ( )
inlinestatic

Start a new new list.

Must be matched with a call to endList(). Entries can be nested with more calls to startList(), startDict(), etc.


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