diff options
author | antonovvk <antonovvk@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
commit | 37de222addabbef336dcaaea5f7c7645a629fc6d (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /util/stream | |
parent | 37a63debdc21e372d99e1808cdd31aecf75018c3 (diff) | |
download | ydb-37de222addabbef336dcaaea5f7c7645a629fc6d.tar.gz |
Restoring authorship annotation for <antonovvk@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream')
-rw-r--r-- | util/stream/format.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/stream/format.h b/util/stream/format.h index 8589e84d76..b033208a1b 100644 --- a/util/stream/format.h +++ b/util/stream/format.h @@ -12,10 +12,10 @@ enum ENumberFormatFlag { HF_FULL = 0x01, /**< Output number with leading zeros. */ HF_ADDX = 0x02, /**< Output '0x' or '0b' before hex/bin digits. */ -}; +}; Y_DECLARE_FLAGS(ENumberFormat, ENumberFormatFlag) Y_DECLARE_OPERATORS_FOR_FLAGS(ENumberFormat) - + enum ESizeFormat { SF_QUANTITY, /**< Base 1000, usual suffixes. 1100 gets turned into "1.1K". */ SF_BYTES, /**< Base 1024, byte suffix. 1100 gets turned into "1.07KiB". */ @@ -89,20 +89,20 @@ namespace NFormatPrivate { } return o; } - + template <typename T, size_t Base> struct TBaseNumber { T Value; ENumberFormat Flags; - + template <typename OtherT> inline TBaseNumber(OtherT value, ENumberFormat flags) - : Value(value) - , Flags(flags) - { - } - }; - + : Value(value) + , Flags(flags) + { + } + }; + template <typename T, size_t Base> using TUnsignedBaseNumber = TBaseNumber<std::make_unsigned_t<std::remove_cv_t<T>>, Base>; @@ -255,11 +255,11 @@ static constexpr ::NFormatPrivate::TRightPad<const T*> RightPad(const T (&value) * @param value Value to output. * @param flags Output flags. */ -template <typename T> +template <typename T> static constexpr ::NFormatPrivate::TUnsignedBaseNumber<T, 16> Hex(const T& value, const ENumberFormat flags = HF_FULL | HF_ADDX) noexcept { return {value, flags}; -} - +} + /** * Output manipulator similar to `std::setbase(16)`. * |