WvStreams
|
00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * Hex encoder and hex decoder. 00006 */ 00007 #ifndef __WVHEX_H 00008 #define __WVHEX_H 00009 00010 #include "wvencoder.h" 00011 00021 class WvHexEncoder : public WvEncoder 00022 { 00023 char alphabase; 00024 00025 public: 00033 WvHexEncoder(bool use_uppercase = false); 00034 virtual ~WvHexEncoder() { } 00035 00036 protected: 00037 virtual bool _encode(WvBuf &in, WvBuf &out, bool flush); 00038 virtual bool _reset(); // supported 00039 }; 00040 00041 00053 class WvHexDecoder : public WvEncoder 00054 { 00055 bool issecond; 00056 int first; 00057 00058 public: 00060 WvHexDecoder(); 00061 virtual ~WvHexDecoder() { } 00062 00063 protected: 00064 virtual bool _encode(WvBuf &in, WvBuf &out, bool flush); 00065 virtual bool _reset(); // supported 00066 }; 00067 00085 void hexify(char *obuf, const void *ibuf, size_t len); 00086 00092 void unhexify(void *obuf, const char *ibuf); 00093 00094 #endif // __WVHEX_H