D++ (DPP)
C++ Discord API Bot Library
dpp::utility::iconhash Struct Reference

Store a 128 bit icon hash (profile picture, server icon etc) as a 128 bit binary value made of two uint64_t. Has a constructor to build one from a string, and a method to fetch the value back in string form. More...

#include <utility.h>

+ Collaboration diagram for dpp::utility::iconhash:

Public Member Functions

 iconhash (uint64_t _first=0, uint64_t _second=0) noexcept
 Construct a new iconhash object. More...
 
 iconhash (const std::string &hash)
 Construct a new iconhash object. More...
 
iconhashoperator= (const std::string &assignment)
 Assign from std::string. More...
 
bool operator== (const iconhash &other) const noexcept
 Check if one iconhash is equal to another. More...
 
void set (const std::string &hash)
 Change value of iconhash object. More...
 
std::string to_string () const
 Convert iconhash back to 32 character string value. More...
 

Public Attributes

uint64_t first
 High 64 bits. More...
 
uint64_t second
 Low 64 bits. More...
 

Detailed Description

Store a 128 bit icon hash (profile picture, server icon etc) as a 128 bit binary value made of two uint64_t. Has a constructor to build one from a string, and a method to fetch the value back in string form.

Constructor & Destructor Documentation

◆ iconhash() [1/2]

dpp::utility::iconhash::iconhash ( uint64_t  _first = 0,
uint64_t  _second = 0 
)
noexcept

Construct a new iconhash object.

Parameters
_firstLeftmost portion of the hash value
_secondRightmost portion of the hash value

◆ iconhash() [2/2]

dpp::utility::iconhash::iconhash ( const std::string &  hash)

Construct a new iconhash object.

Parameters
hashString hash to construct from. Must contain a 32 character hex string.
Exceptions
std::length_errorif the provided string is not exactly 32 characters long.

Member Function Documentation

◆ operator=()

iconhash & dpp::utility::iconhash::operator= ( const std::string &  assignment)

Assign from std::string.

Parameters
assignmentstring to assign from.
Exceptions
std::length_errorif the provided string is not exactly 32 characters long.

◆ operator==()

bool dpp::utility::iconhash::operator== ( const iconhash other) const
noexcept

Check if one iconhash is equal to another.

Parameters
otherother iconhash to compare
Returns
True if the iconhash objects match

◆ set()

void dpp::utility::iconhash::set ( const std::string &  hash)

Change value of iconhash object.

Parameters
hashString hash to change to. Must contain a 32 character hex string.
Exceptions
std::length_errorif the provided string is not exactly 32 characters long.

◆ to_string()

std::string dpp::utility::iconhash::to_string ( ) const

Convert iconhash back to 32 character string value.

Returns
std::string Hash value

Member Data Documentation

◆ first

uint64_t dpp::utility::iconhash::first

High 64 bits.

◆ second

uint64_t dpp::utility::iconhash::second

Low 64 bits.

D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0