From a51a54bc5979a2491f152abc47ad54e6b63f27c8 Mon Sep 17 00:00:00 2001 From: Dylam De La Torre Date: Tue, 23 Nov 2021 05:21:56 +0100 Subject: Restructure source and resource files (#46) importantly, res is now res/res and css is now res/css --- discord/snowflake.hpp | 55 --------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 discord/snowflake.hpp (limited to 'discord/snowflake.hpp') diff --git a/discord/snowflake.hpp b/discord/snowflake.hpp deleted file mode 100644 index 0b79723..0000000 --- a/discord/snowflake.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#include -#include -#include - -struct Snowflake { - Snowflake(); - Snowflake(uint64_t n); - Snowflake(const std::string &str); - Snowflake(const Glib::ustring &str); - - static Snowflake FromNow(); // not thread safe - - bool IsValid() const; - std::string GetLocalTimestamp() const; - - bool operator==(const Snowflake &s) const noexcept { - return m_num == s.m_num; - } - - bool operator<(const Snowflake &s) const noexcept { - return m_num < s.m_num; - } - - operator uint64_t() const noexcept { - return m_num; - } - - const static Snowflake Invalid; // makes sense to me - const static uint64_t SecondsInterval = 4194304000ULL; // the "difference" between two snowflakes one second apart - - friend void from_json(const nlohmann::json &j, Snowflake &s); - friend void to_json(nlohmann::json &j, const Snowflake &s); - -private: - friend struct std::hash; - friend struct std::less; - unsigned long long m_num; -}; - -namespace std { -template<> -struct hash { - std::size_t operator()(const Snowflake &k) const { - return k.m_num; - } -}; - -template<> -struct less { - bool operator()(const Snowflake &l, const Snowflake &r) const { - return l.m_num < r.m_num; - } -}; -} // namespace std -- cgit v1.2.3