Static Public Member Functions | List of all members
Celartem::Hex Struct Reference

#include <cel_misc.h>

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.

Member Function Documentation

static int Celartem::Hex::_1char ( int  chr)
inlinestatic

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

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

Referenced by fromStrToInt().

static int Celartem::Hex::_1digit ( int  n)
inlinestatic

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

Parameters
nA value of [0 15].
Returns
The character corresponding to the input value.

Referenced by fromByte().

static void Celartem::Hex::fromByte ( UChar1 buffer,
u8  n 
)
inlinestatic

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

Parameters
bufferA buffer to get the result; it should be larger than 2 byte.
nthe number to be converted.
static void Celartem::Hex::fromString ( SimpleArray< u8 > &  outBin,
const String str 
)
static

Converts a string into binary data.

Parameters
outBinBuffer to receive the result binary.
strhex 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
outBinBuffer to receive the result binary.
inSizeThe size of the buffer.
strhex 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.
static int Celartem::Hex::fromStrToInt ( const UChar1 str,
size_t  length 
)
inlinestatic

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

Parameters
strA string that represents some number in hexa-decimal notation.
lengthThe length of the string.
Returns
The value.
static String Celartem::Hex::toString ( const u8 bin,
size_t  size,
const String sep 
)
static

Converts a binary array into string.

Parameters
binPointer to a binary block.
sizeThe size of the binary block specified by bin .
sepA 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.

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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo