MCPcopy Create free account
hub / github.com/apache/brpc / ToPrintable

Class ToPrintable

src/butil/binary_printer.h:31–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29// The printing format is optimized for humans and may change in future.
30
31class ToPrintable {
32public:
33 static const size_t DEFAULT_MAX_LENGTH = 64;
34
35 ToPrintable(const IOBuf& b, size_t max_length = DEFAULT_MAX_LENGTH)
36 : _iobuf(&b), _max_length(max_length) {}
37
38 ToPrintable(const StringPiece& str, size_t max_length = DEFAULT_MAX_LENGTH)
39 : _iobuf(NULL), _str(str), _max_length(max_length) {}
40
41 ToPrintable(const void* data, size_t n, size_t max_length = DEFAULT_MAX_LENGTH)
42 : _iobuf(NULL), _str((const char*)data, n), _max_length(max_length) {}
43
44 void Print(std::ostream& os) const;
45
46private:
47 const IOBuf* _iobuf;
48 StringPiece _str;
49 size_t _max_length;
50};
51
52// Keep old name for compatibility.
53typedef ToPrintable PrintedAsBinary;

Callers 7

TEST_FFunction · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
ProcessNewMessageMethod · 0.85
rtmp.cppFile · 0.85
PrintMethod · 0.85
ParseFromIOBufMethod · 0.85

Calls

no outgoing calls

Tested by 3

TEST_FFunction · 0.68
TEST_FFunction · 0.68
TESTFunction · 0.68