From db531191789f48a141c42fef229bca7a7922443d Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 3 Oct 2024 12:35:44 +0200 Subject: cache get command (#183) * move TryParseObjectId and TryParseIoHash to Oid::TryParse and IoHash::TryParse respectively * zen cache-get command --- src/zencore/include/zencore/iohash.h | 1 + src/zencore/include/zencore/uid.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/zencore/include') diff --git a/src/zencore/include/zencore/iohash.h b/src/zencore/include/zencore/iohash.h index a8fc9e6c1..9c9f487bb 100644 --- a/src/zencore/include/zencore/iohash.h +++ b/src/zencore/include/zencore/iohash.h @@ -50,6 +50,7 @@ struct IoHash static IoHash HashBuffer(const IoBuffer& Buffer); static IoHash FromHexString(const char* string); static IoHash FromHexString(const std::string_view string); + static bool TryParse(std::string_view Str, IoHash& Hash); const char* ToHexString(char* outString /* 40 characters + NUL terminator */) const; StringBuilderBase& ToHexString(StringBuilderBase& outBuilder) const; std::string ToHexString() const; diff --git a/src/zencore/include/zencore/uid.h b/src/zencore/include/zencore/uid.h index 08a335392..1b6fc3f6a 100644 --- a/src/zencore/include/zencore/uid.h +++ b/src/zencore/include/zencore/uid.h @@ -63,6 +63,7 @@ struct Oid const Oid& Generate(); [[nodiscard]] static Oid FromHexString(const std::string_view String); [[nodiscard]] static Oid TryFromHexString(const std::string_view String, const Oid& Default = Oid::Zero); + static bool TryParse(std::string_view Str, Oid& Id); StringBuilderBase& ToString(StringBuilderBase& OutString) const; void ToString(char OutString[StringLength]) const; std::string ToString() const; -- cgit v1.2.3