Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvhex.cc File Reference

#include "wvhex.h"
#include <ctype.h>

Go to the source code of this file.

Functions

char tohex (int digit, char alphabase)
int fromhex (char digit)
void hexify (char *obuf, const void *ibuf, size_t len)
 Write the contents of the binary string of length 'len' pointed to by 'ibuf' into the output buffer 'obuf' in hexadecimal format.

void unhexify (void *obuf, const char *ibuf)
 Reverse the operation performed by hexify().


Function Documentation

int fromhex char  digit  )  [inline, static]
 

Definition at line 15 of file wvhex.cc.

Referenced by WvHexDecoder::_encode(), and WvBackslashDecoder::_encode().

void hexify char *  obuf,
const void *  ibuf,
size_t  len
 

Write the contents of the binary string of length 'len' pointed to by 'ibuf' into the output buffer 'obuf' in hexadecimal format.

For example, if len==4, ibuf=="ABCDEF", then obuf will contain "41424344" with a terminating NULL character.

This is useful to turn arbitrary binary into a simple printable format, so that it can (for example) be written to a WvConf configuration file.

obuf must be a buffer with at least (len * 2) + 1 bytes available. (two digits for each byte of ibuf, plus a terminating NULL).

Definition at line 94 of file wvhex.cc.

char tohex int  digit,
char  alphabase
[inline, static]
 

Definition at line 10 of file wvhex.cc.

Referenced by WvHexEncoder::_encode(), and WvBackslashEncoder::_encode().

void unhexify void *  obuf,
const char *  ibuf
 

Reverse the operation performed by hexify().

obuf must be a buffer large enough to contain the entire binary output string; you can calculate this size with (strlen(ibuf) / 2). obuf will NOT be automatically NULL-terminated.

Definition at line 103 of file wvhex.cc.


Generated on Sat Feb 21 21:05:43 2004 for WvStreams by doxygen 1.3.5