|   |   | 
|  | |
#include <pantheios/inserters/b64.hpp>
This class formats a binary region into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement:
int ar[2] = { 0x00112233, 0x44556677 }; char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", b64=", pantheios::b64(ar, sizeof(ar)), ", str=", str);
This will produce the output:
s=abc, b64=0011223344556677, str=def
The bytes can be grouped and these groups separated. Consider the following statement:
int ar[2] = { 0x00112233, 0x44556677 }; char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", b64=", pantheios::b64(ar, sizeof(ar), 2, "-"), ", str=", str);
This will produce the output:
s=abc, b64=2233-0011-6677-4455, str=def
The output can be split into lines. Consider the following statement:
int ar[2] = { 0x00112233, 0x44556677 }; char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", b64=", pantheios::b64(ar, sizeof(ar), 2, "-", 3, "\n\t"), ", str=", str);
This will produce the output:
  s=abc, b64=2233-0011-6677
          4455, str=def
 | Public Types | |
| Member Types | |
| typedef b64 | class_type | 
| typedef b64_api::B64_RC | B64_RC | 
| Public Member Functions | |
| Construction | |
| b64 (void const *pv, size_t cb) | |
| b64 (void const *pv, size_t cb, unsigned flags) | |
| b64 (void const *pv, size_t cb, unsigned flags, int lineLen, B64_RC *rc=NULL) | |
| ~b64 () throw () | |
| Accessors | |
| pan_char_t const * | data () const | 
| A possibly non-nul-terminated non-null pointer to the c-style string representation of the integer. | |
| pan_char_t const * | c_str () const | 
| A nul-terminated non-null pointer to the c-style string representation of the integer. | |
| size_t | length () const | 
| The length of the c-style string representation of the integer. | |
| pan_char_t const* data | ( | ) | const | 
| pan_char_t const* c_str | ( | ) | const | 
| size_t length | ( | ) | const | 
The length of the c-style string representation of the integer.
|  | |
| pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 |  |