Celartem::Hex Struct Reference

#include <cel_misc.h>

List of all members.

Static Public Member Functions

static int _1digit (int n)
static int _1char (int chr)
static int fromStrToInt (const UChar1 *str, size_t length)
static void fromByte (UChar1 *buffer, u8 n)
static String toString (const u8 *bin, size_t size, const String &sep)
static void fromString (SimpleArray< u8 > &outBin, const String &str)
static size_t fromString (u8 *outBin, size_t inSize, const String &str)


Detailed Description

Utility functions to manipulate Hexa-decimal numbers.

Definition at line 82 of file cel_misc.h.


Member Function Documentation

static int Celartem::Hex::_1digit ( int  n  )  [inline, static]

Converts a value of [0 15] into an ASCII character that represents the value.

Parameters:
n A value of [0 15].
Returns:
The character corresponding to the input value.

Definition at line 92 of file cel_misc.h.

Referenced by fromByte().

static int Celartem::Hex::_1char ( int  chr  )  [inline, static]

Converts one of a character of [0-9A-Fa-f] into an integral value.

Parameters:
chr a character code of [0-9A-Fa-f].
Returns:
The value corresponding to the character.

Definition at line 103 of file cel_misc.h.

Referenced by fromStrToInt().

static int Celartem::Hex::fromStrToInt ( const UChar1 str,
size_t  length 
) [inline, static]

Converts a hexa-decimal notation of a number into an integral value. Please note that this function does not care about overflow.

Parameters:
str A string that represents some number in hexa-decimal notation.
length The length of the string.
Returns:
The value.

Definition at line 121 of file cel_misc.h.

static void Celartem::Hex::fromByte ( UChar1 buffer,
u8  n 
) [inline, static]

Converts an u8 number into 2-byte long string without any '\0' termination.

Parameters:
buffer A buffer to get the result; it should be larger than 2 byte.
n the number to be converted.

Definition at line 140 of file cel_misc.h.

static String Celartem::Hex::toString ( const u8 bin,
size_t  size,
const String sep 
) [static]

Converts a binary array into string.

Parameters:
bin Pointer to a binary block.
size The size of the binary block specified by bin .
sep A string to split the string that represents the string. If you want to get strings like "00:11:22:33" then this is ":" .
Returns:
The string notation of the binary.

static void Celartem::Hex::fromString ( SimpleArray< u8 > &  outBin,
const String str 
) [static]

Converts a string into binary data.

Parameters:
outBin Buffer to receive the result binary.
str hex encoded binary. This can be contain non hexa-decimal characters, which are simply skipped during the conversion.

static size_t Celartem::Hex::fromString ( u8 outBin,
size_t  inSize,
const String str 
) [static]

Converts a string into binary data.

Parameters:
outBin Buffer to receive the result binary.
inSize The size of the buffer.
str hex encoded binary. This can be contain non hexa-decimal characters, which are simply skipped during the conversion.
Returns:
Returns the number of bytes actually written to the buffer.


The documentation for this struct was generated from the following file:
This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:23:18 2008.