From 61f19c5d26fc586b58c36f76c787c6f8ba5d6775 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 15 Jul 2022 14:12:07 +0200 Subject: ObjectInfo: Support stringify with unknown size --- src/buildtool/common/artifact.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/buildtool/common/artifact.hpp b/src/buildtool/common/artifact.hpp index a073b0d7..3a713659 100644 --- a/src/buildtool/common/artifact.hpp +++ b/src/buildtool/common/artifact.hpp @@ -32,10 +32,13 @@ class Artifact { } // Create string of the form '[hash:size:type]' - [[nodiscard]] auto ToString() const noexcept -> std::string { + [[nodiscard]] auto ToString(bool size_unknown = false) const noexcept + -> std::string { + auto size_str = + size_unknown ? std::string{} : std::to_string(digest.size()); return fmt::format("[{}:{}:{}]{}", digest.hash(), - digest.size(), + size_str, ToChar(type), failed ? " FAILED" : ""); } -- cgit v1.2.3