Safely wraps StrFormat() captures of %n conversions into an integer value.
Synopsis
Declared in <absl/strings/str_format.h>
class FormatCountCapture;
Description
%n conversions denote the number of characters written by a formatting operation to this point.
This wrapper is designed to allow safe usage of %n within `StrFormat(); in the printf() family of functions, %n is not safe to use, as the int * buffer can be used to capture arbitrary data.
Example:
int n = 0; std::string s = absl::StrFormat("%s%d%n", "hello", 123, absl::FormatCountCapture(&n)); EXPECT_EQ(8, n);
Member Functions
Name |
Description |
|
Constructs a capture that writes the character count to |
Friends
Name |
Description |
|
Created with MrDocs