mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-04 11:33:27 +03:00
add Snowflake ctor for Glib::ustring
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
Snowflake::Snowflake()
|
||||
: m_num(Invalid) {}
|
||||
|
||||
|
||||
Snowflake::Snowflake(uint64_t n)
|
||||
: m_num(n) {}
|
||||
|
||||
@@ -12,6 +11,12 @@ Snowflake::Snowflake(const std::string &str) {
|
||||
m_num = std::stoull(str);
|
||||
else
|
||||
m_num = Invalid;
|
||||
}
|
||||
Snowflake::Snowflake(const Glib::ustring &str) {
|
||||
if (str.size())
|
||||
m_num = std::strtoull(str.c_str(), nullptr, 10);
|
||||
else
|
||||
m_num = Invalid;
|
||||
};
|
||||
|
||||
bool Snowflake::IsValid() const {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
struct Snowflake {
|
||||
Snowflake();
|
||||
Snowflake(uint64_t n);
|
||||
Snowflake(const std::string &str);
|
||||
Snowflake(const Glib::ustring &str);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user