add Snowflake ctor for Glib::ustring

This commit is contained in:
ouwou
2020-10-29 02:00:50 -04:00
parent c9162544f6
commit dfc2fb1cd8
2 changed files with 8 additions and 1 deletions

View File

@@ -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 {