22#include "mongo/base/string_data.h"
23#include "mongo/bson/util/builder.h"
27 inline int fromHex(
char c ) {
28 if (
'0' <= c && c <=
'9' )
30 if (
'a' <= c && c <=
'f' )
32 if (
'A' <= c && c <=
'F' )
37 inline char fromHex(
const char *c ) {
38 return (
char)(( fromHex( c[ 0 ] ) << 4 ) | fromHex( c[ 1 ] ));
40 inline char fromHex(
const StringData& c ) {
41 return (
char)(( fromHex( c[ 0 ] ) << 4 ) | fromHex( c[ 1 ] ));
44 inline std::string toHex(
const void* inRaw,
int len) {
45 static const char hexchars[] =
"0123456789ABCDEF";
48 const char* in =
reinterpret_cast<const char*
>(inRaw);
49 for (
int i=0; i<len; ++i) {
51 char hi = hexchars[(c & 0xF0) >> 4];
52 char lo = hexchars[(c & 0x0F)];
60 template <
typename T> std::string integerToHex(T val);
62 inline std::string toHexLower(
const void* inRaw,
int len) {
63 static const char hexchars[] =
"0123456789abcdef";
66 const char* in =
reinterpret_cast<const char*
>(inRaw);
67 for (
int i=0; i<len; ++i) {
69 char hi = hexchars[(c & 0xF0) >> 4];
70 char lo = hexchars[(c & 0x0F)];
the main MongoDB namespace
Definition bulk_operation_builder.h:24