dpp::bignumber
bignum.h
dpp::bignumber::bn_deleter
std::unique_ptr< openssl_bignum, bn_deleter > std::unique_ptr<openssl_bignum, bn_deleter> dpp::bignumber::ssl_bn ssl_bn dpp::bignumber::ssl_bn

Internal opaque struct to contain OpenSSL things.

dpp::bignumber::bignumber
()=default
bignumber
dpp::bignumber::bignumber

Construct a new bignumber object.

dpp::bignumber::bignumber
(const std::string &number_string)
bignumber
dpp::bignumber::bignumber
const std::string & number_string

Parse a std::string of an arbitrary length number into a bignumber.

number_string

string representation of a number. The number must be an integer, and can be positive or negative.

Prefixing number_string with 0x will parse it as hexadecimal. This is not case sensitive.

dpp::bignumber::bignumber
(std::vector< uint64_t > bits)
bignumber
dpp::bignumber::bignumber
std::vector< uint64_t > bits

Build a bignumber from a vector of 64 bit values. The values are accepted in "reverse order", so the first vector entry at index 0 is the leftmost 64 bits of the bignum. The vector can be any arbitrary length.

bits

Vector of 64 bit values which represent the number

dpp::bignumber::~bignumber
()=default
~bignumber
dpp::bignumber::~bignumber

Default destructor.

std::vector< uint64_t > std::vector< uint64_t > dpp::bignumber::get_binary () const get_binary dpp::bignumber::get_binary

Get the array of 64 bit values that represents the bignumber. This is what we should use to store bignumbers in memory, not this bignumber class itself, as the bignumber class instantiates OpenSSL structs and takes significantly more ram than just a vector.

Vector of 64 bit values representing the bignumber

std::string std::string dpp::bignumber::get_number (bool hex=false) const get_number dpp::bignumber::get_number bool hex false

Get the string representation of the bignumber.

hex

If false (the default) the number is returned in decimal, else if this parameter is true, it will be returned as hex (without leading '0x')

String representation of bignumber

An arbitrary length integer number. Officially, the Discord documentation says that permission values can be any arbitrary number of digits. At time of writing there are only 50 bits of permissions, but this is set to grow larger and potentially past 64 bits. They will continue to send this data as a huge single integer at that point, because this is obviously sensible. /s.

dpp::bignumber uses OpenSSL BN_* under the hood, as we include openssl anyway for HTTPS.

- dpp::bignumber
  bignumber
- dpp::bignumber
  bignumber
- dpp::bignumber
  bignumber
- dpp::bignumber
  get_binary
- dpp::bignumber
  get_number
- dpp::bignumber
  ssl_bn
- dpp::bignumber
  ~bignumber