class FormattedBytes
Defined at line 40 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes is an inline buffer suitable for containing formatted byte
sizes.
Typical usage is as follows:
printf("Free memory: %s\n", FormattedBytes(12345).str());
See `format_size` and `format_size_fixed` in
<pretty
/sizes.h> for details.
Public Methods
void FormattedBytes ()
Construct an empty string.
Defined at line 47 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (size_t size)
Construct a string representing the given size.
Chooses an appropriate unit ('k', 'M', etc) based on the size.
Defined at line 52 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (size_t size)
Construct a string representing the given size.
Chooses an appropriate unit ('k', 'M', etc) based on the size.
Defined at line 52 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (size_t size)
Construct a string representing the given size.
Chooses an appropriate unit ('k', 'M', etc) based on the size.
Defined at line 52 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (size_t size, SizeUnit unit)
Construct a string representing the given size, using the given units.
Defined at line 55 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (size_t size, SizeUnit unit)
Construct a string representing the given size, using the given units.
Defined at line 55 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (size_t size, SizeUnit unit)
Construct a string representing the given size, using the given units.
Defined at line 55 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
void FormattedBytes (const FormattedBytes & )
Default copy operators.
Defined at line 58 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & operator= (const FormattedBytes & )
Defined at line 59 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & SetSize (size_t size)
Update the string to the given size.
Defined at line 62 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & SetSize (size_t size)
Update the string to the given size.
Defined at line 62 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & SetSize (size_t size)
Update the string to the given size.
Defined at line 62 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & SetSize (size_t size, SizeUnit unit)
Defined at line 66 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & SetSize (size_t size, SizeUnit unit)
Defined at line 66 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
FormattedBytes & SetSize (size_t size, SizeUnit unit)
Defined at line 66 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
std::string_view str ()
Return the formatted string.
Defined at line 72 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
const char * c_str ()
Return the formatted string as a C-style NUL-terminated string.
Defined at line 75 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
std::string_view Magnitude ()
Returns the formatted magnitude as a string.
Defined at line 78 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
SizeUnit Unit ()
Returns the associated SizeUnit. In the case of the empty string, kAuto
is returned.
Defined at line 86 of file ../../zircon/system/ulib/pretty/include/pretty/cpp/sizes.h
std::string_view ToString (SizeUnit unit)
Returns how the given SizeUnit will be formatted, except in the case of
kAuto, for which the empty string is returned.
Defined at line 98 of file ../../zircon/system/ulib/pretty/sizes.cc