7 std::vector<unsigned char> ParseHex(
const char* psz);
8 std::vector<unsigned char> ParseHex(
const char* psz,
bool &fIsHex);
9 std::vector<unsigned char> ParseHex(
const std::string& str);
11 signed char HexDigit(
char c);
12 bool IsHex(
const std::string& str);
15 std::string HexStr(
const T itbegin,
const T itend,
bool fSpaces=
false)
18 static const char hexmap[16] = {
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
19 '8',
'9',
'a',
'b',
'c',
'd',
'e',
'f' };
20 rv.reserve((itend-itbegin)*3);
21 for(T it = itbegin; it < itend; ++it)
23 unsigned char val = (
unsigned char)(*it);
24 if(fSpaces && it != itbegin)
26 rv.push_back(hexmap[val>>4]);
27 rv.push_back(hexmap[val&15]);
34 inline std::string HexStr(
const T& vch,
bool fSpaces=
false)
36 return HexStr(vch.begin(), vch.end(), fSpaces);
39 int32_t parseHexToInt32Le(
const std::string& hexString);
41 #endif // STRCODECLIB_H