diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-15 14:12:07 +0200 |
---|---|---|
committer | Sascha Roloff <sascha.roloff@huawei.com> | 2022-08-05 14:41:31 +0200 |
commit | 61f19c5d26fc586b58c36f76c787c6f8ba5d6775 (patch) | |
tree | cbc9da6e6133a660faf01a59fca6321f40494a7a | |
parent | 668ffe386d7c0b81238c02e6cbbe3a28b96e62d7 (diff) | |
download | justbuild-61f19c5d26fc586b58c36f76c787c6f8ba5d6775.tar.gz |
ObjectInfo: Support stringify with unknown size
-rw-r--r-- | src/buildtool/common/artifact.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
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" : ""); } |