![]()  | 
  
    D++ (DPP)
    
   C++ Discord API Bot Library 
   | 
 
A container for a 64 bit unsigned value representing many things on discord. This value is known in distributed computing as a snowflake value. More...
 Collaboration diagram for dpp::snowflake:Public Member Functions | |
| constexpr | snowflake () noexcept=default | 
| Construct a snowflake object.  More... | |
| constexpr | snowflake (const snowflake &rhs) noexcept=default | 
| Copy a snowflake object.  More... | |
| template<typename T , typename = std::enable_if_t<std::is_same_v<T, std::string>>> | |
| snowflake (const T &string_value) noexcept | |
| Construct a snowflake object from an unsigned integer in a string.  More... | |
| constexpr | snowflake (snowflake &&rhs) noexcept=default | 
| Move a snowflake object.  More... | |
| snowflake (std::string_view string_value) noexcept | |
| Construct a snowflake object from an unsigned integer in a string.  More... | |
| template<typename T , typename = std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>>> | |
| constexpr | snowflake (T snowflake_val) noexcept(std::is_unsigned_v< T >) | 
| Construct a snowflake from an integer value.  More... | |
| constexpr bool | empty () const noexcept | 
| Returns true if the snowflake holds an empty value (is 0)  More... | |
| constexpr double | get_creation_time () const noexcept | 
| Get the creation time of this snowflake according to Discord.  More... | |
| constexpr uint16_t | get_increment () const noexcept | 
| Get the increment, which is incremented for every snowflake created over the one millisecond resolution in the timestamp.  More... | |
| constexpr uint8_t | get_process_id () const noexcept | 
| Get the process id that produced this snowflake value.  More... | |
| constexpr uint8_t | get_worker_id () const noexcept | 
| Get the worker id that produced this snowflake value.  More... | |
| operator json () const | |
| For building json.  More... | |
| constexpr | operator uint64_t () const noexcept | 
| For acting like an integer.  More... | |
| constexpr | operator uint64_t & () noexcept | 
| For acting like an integer.  More... | |
| constexpr dpp::snowflake & | operator= (const dpp::snowflake &rhs) noexcept=default | 
| Copy value from another snowflake.  More... | |
| constexpr dpp::snowflake & | operator= (dpp::snowflake &&rhs) noexcept=default | 
| Move value from another snowflake.  More... | |
| template<typename T , typename = std::enable_if_t<std::is_convertible_v<T, std::string_view>>> | |
| constexpr dpp::snowflake & | operator= (T &&snowflake_val) noexcept | 
| Assign value converted from a string to the snowflake.  More... | |
| template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
| constexpr dpp::snowflake & | operator= (T snowflake_val) noexcept(std::is_unsigned_v< T >) | 
| Assign integer value to the snowflake.  More... | |
| constexpr bool | operator== (dpp::snowflake snowflake_val) const noexcept | 
| Comparison operator with another snowflake.  More... | |
| bool | operator== (std::string_view snowflake_val) const noexcept | 
| Comparison operator with a string.  More... | |
| template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
| constexpr bool | operator== (T snowflake_val) const noexcept | 
| Comparison operator with an integer.  More... | |
| std::string | str () const | 
| Returns the stringified version of the snowflake value.  More... | |
Protected Attributes | |
| uint64_t | value = 0 | 
| The snowflake value.  More... | |
Friends | |
| constexpr friend uint64_t | format_as (snowflake s) noexcept | 
| Helper function for libfmt so that a snowflake can be directly formatted as a uint64_t.  More... | |
| struct | std::hash< dpp::snowflake > | 
A container for a 64 bit unsigned value representing many things on discord. This value is known in distributed computing as a snowflake value.
Snowflakes are:
An identical format of snowflake is used by Twitter, Instagram and several other platforms.
      
  | 
  constexprdefaultnoexcept | 
Construct a snowflake object.
      
  | 
  constexprdefaultnoexcept | 
Copy a snowflake object.
      
  | 
  constexprdefaultnoexcept | 
Move a snowflake object.
      
  | 
  inlineconstexprnoexcept | 
Construct a snowflake from an integer value.
| dpp::logic_exception | on assigning a negative value. The function is noexcept if the type given is unsigned | 
| snowflake_val | snowflake value as an integer type | 
we cast to the unsigned version of the type given - this maintains "possible loss of data" warnings for sizeof(T) > sizeof(value) while suppressing them for signed to unsigned conversion (for example snowflake(42) will call snowflake(int) which is a signed type)
      
  | 
  noexcept | 
Construct a snowflake object from an unsigned integer in a string.
On invalid string the value will be 0
| string_value | A snowflake value | 
      
  | 
  inlinenoexcept | 
Construct a snowflake object from an unsigned integer in a string.
On invalid string the value will be 0
| string_value | A snowflake value | 
      
  | 
  inlineconstexprnoexcept | 
Returns true if the snowflake holds an empty value (is 0)
      
  | 
  inlineconstexprnoexcept | 
Get the creation time of this snowflake according to Discord.
      
  | 
  inlineconstexprnoexcept | 
Get the increment, which is incremented for every snowflake created over the one millisecond resolution in the timestamp.
      
  | 
  inlineconstexprnoexcept | 
Get the process id that produced this snowflake value.
      
  | 
  inlineconstexprnoexcept | 
Get the worker id that produced this snowflake value.
| dpp::snowflake::operator json | ( | ) | const | 
For building json.
      
  | 
  inlineconstexprnoexcept | 
For acting like an integer.
      
  | 
  inlineconstexprnoexcept | 
For acting like an integer.
      
  | 
  constexprdefaultnoexcept | 
Copy value from another snowflake.
| rhs | The snowflake to copy from | 
      
  | 
  constexprdefaultnoexcept | 
Move value from another snowflake.
| rhs | The snowflake to move from | 
      
  | 
  inlineconstexprnoexcept | 
Assign value converted from a string to the snowflake.
On invalid string the value will be 0
| snowflake_val | snowflake value as a string | 
      
  | 
  inlineconstexprnoexcept | 
Assign integer value to the snowflake.
| dpp::logic_exception | on assigning a negative value. The function is noexcept if the type given is unsigned | 
| snowflake_val | snowflake value as an integer type | 
      
  | 
  inlineconstexprnoexcept | 
Comparison operator with another snowflake.
| snowflake_val | snowflake | 
      
  | 
  noexcept | 
Comparison operator with a string.
| snowflake_val | snowflake value as a string | 
      
  | 
  inlineconstexprnoexcept | 
Comparison operator with an integer.
| snowflake_val | snowflake value as an integer type | 
      
  | 
  inline | 
Returns the stringified version of the snowflake value.
      
  | 
  friend | 
Helper function for libfmt so that a snowflake can be directly formatted as a uint64_t.
      
  | 
  friend | 
      
  | 
  protected | 
The snowflake value.