Erixonich commented on code in PR #7966:
URL: https://github.com/apache/ignite-3/pull/7966#discussion_r3079319881
##########
modules/platforms/cpp/ignite/common/uuid.h:
##########
@@ -46,6 +50,64 @@ class uuid {
: most(most)
, least(least) {}
+ /**
+ * Parses string-encoded uuid.
+ * Example of possible input value: ff979603-fb56-49e9-bc79-7c4487bbbafd.
+ * @param text String-encoded uuid.
+ * @return @c uuid object if parsing was successful, otherwise empty
optional.
+ */
+ static std::optional<uuid> from_string(const std::string& text) {
+ if (text.length() != 36) {
+ return {};
+ }
+
+ auto str = text.c_str();
+
+ auto parse_chunk = [str](size_t beg, size_t end, uint64_t& out) ->
bool {
+ char* p;
+
+ if (errno != 0) {
+ errno = 0;
+ }
+
+ out = std::strtoull(str + beg, &p, 16);
+
+ if (p != str + end || (*p != '-' && *p != '\0') || errno ==
ERANGE) {
+ return false;
+ }
+
+ return true;
+ };
+
+ uint64_t msb1, msb2, msb3;
+ uint64_t lsb1, lsb2;
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]