WvStreams
include/wvhex.h
Go to the documentation of this file.
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * Hex encoder and hex decoder.
6 */
7#ifndef __WVHEX_H
8#define __WVHEX_H
9
10#include "wvencoder.h"
11
21class WvHexEncoder : public WvEncoder
22{
23 char alphabase;
24
25public:
33 WvHexEncoder(bool use_uppercase = false);
34 virtual ~WvHexEncoder() { }
35
36protected:
37 virtual bool _encode(WvBuf &in, WvBuf &out, bool flush);
38 virtual bool _reset(); // supported
39};
40
41
53class WvHexDecoder : public WvEncoder
54{
55 bool issecond;
56 int first;
57
58public:
61 virtual ~WvHexDecoder() { }
62
63protected:
64 virtual bool _encode(WvBuf &in, WvBuf &out, bool flush);
65 virtual bool _reset(); // supported
66};
67
85void hexify(char *obuf, const void *ibuf, size_t len);
86
92void unhexify(void *obuf, const char *ibuf);
93
94#endif // __WVHEX_H
bool flush(WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
Flushes the encoder and optionally finishes it.
virtual bool _reset()
Template method implementation of reset().
WvHexDecoder()
Creates a hex decoder.
virtual bool _encode(WvBuf &in, WvBuf &out, bool flush)
Template method implementation of encode().
virtual bool _encode(WvBuf &in, WvBuf &out, bool flush)
Template method implementation of encode().
WvHexEncoder(bool use_uppercase=false)
Creates a hex encoder.
virtual bool _reset()
Template method implementation of reset().
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 '...
Definition wvhex.cc:95
void unhexify(void *obuf, const char *ibuf)
Reverse the operation performed by hexify().
Definition wvhex.cc:104