Squid Web Cache
master
Loading...
Searching...
No Matches
IoManip.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
#include "
squid.h
"
10
#include "
base/IoManip.h
"
11
#include "
debug/Stream.h
"
12
13
#include <algorithm>
14
15
void
16
PrintHex
(std::ostream &os,
const
char
*
const
data,
const
size_t
n)
17
{
18
if
(!n)
19
return
;
20
assert
(data);
21
22
const
auto
savedFill = os.fill(
'0'
);
23
const
auto
savedFlags = os.flags();
// std::ios_base::fmtflags
24
os << std::hex;
25
std::for_each(data, data + n,
26
[&os](
const
char
&c) { os << std::setw(2) << static_cast<uint8_t>(c); });
27
os.flags(savedFlags);
28
os.fill(savedFill);
29
}
30
PrintHex
void PrintHex(std::ostream &os, const char *const data, const size_t n)
Prints the first n data bytes using hex notation. Does nothing if n is 0.
Definition
IoManip.cc:16
IoManip.h
assert
#define assert(EX)
Definition
assert.h:17
Stream.h
squid.h
squid
src
base
IoManip.cc
Generated by
1.9.8