| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
dpp::utility::icon Struct Reference

Wrapper class around a variant for either iconhash or image, for API objects that have one or the other (generally iconhash when receiving, image when uploading an image). More...

`#include <utility.h>`

Collaboration diagram for dpp::utility::icon:
[legend]

## Public Member Functions

iconhash & | as_iconhash () &
| Get as icon hash.
iconhash && | as_iconhash () &&
| Get as icon hash.
const iconhash & | as_iconhash () const &
| Get as icon hash.
image_data & | as_image_data () &
| Get as image data.
image_data && | as_image_data () &&
| Get as image.
const image_data & | as_image_data () const &
| Get as image.
bool | is_iconhash () const
| Check whether this icon is stored as an iconhash.
bool | is_image_data () const
| Check whether this icon is stored as an image.
icon & | operator= (const iconhash &hash)
| Assign to iconhash.
icon & | operator= (const image_data &img)
| Assign to image.
icon & | operator= (iconhash &&hash) noexcept
| Assign to iconhash.
icon & | operator= (image_data &&img) noexcept
| Assign to image.

## Public Attributes

std::variant< std::monostate, iconhash, image_data > | hash_or_data
| Iconhash received or image data for upload.

## Detailed Description

Wrapper class around a variant for either iconhash or image, for API objects that have one or the other (generally iconhash when receiving, image when uploading an image).

## Member Function Documentation

## ◆ as_iconhash() [1/3]

iconhash & dpp::utility::icon::as_iconhash | ( |  | ) | &

Get as icon hash.

Warning
  The behavior is undefined if is_iconhash() == false

Returns
  iconhash& This iconhash

## ◆ as_iconhash() [2/3]

iconhash && dpp::utility::icon::as_iconhash | ( |  | ) | &&

Get as icon hash.

Warning
  The behavior is undefined if is_iconhash() == false

Returns
  iconhash& This iconhash

## ◆ as_iconhash() [3/3]

const iconhash & dpp::utility::icon::as_iconhash | ( |  | ) | const &

Get as icon hash.

Warning
  The behavior is undefined if is_iconhash() == false

Returns
  iconhash& This iconhash

## ◆ as_image_data() [1/3]

image_data & dpp::utility::icon::as_image_data | ( |  | ) | &

Get as image data.

Warning
  The behavior is undefined if is_image_data() == false

Returns
  image_data& This image

## ◆ as_image_data() [2/3]

image_data && dpp::utility::icon::as_image_data | ( |  | ) | &&

Get as image.

Warning
  The behavior is undefined if is_image_data() == false

Returns
  image_data& This image

## ◆ as_image_data() [3/3]

const image_data & dpp::utility::icon::as_image_data | ( |  | ) | const &

Get as image.

Warning
  The behavior is undefined if is_image_data() == false

Returns
  image_data& This image

## ◆ is_iconhash()

bool dpp::utility::icon::is_iconhash | ( |  | ) | const

Check whether this icon is stored as an iconhash.

See also
  iconhash

Returns
  bool Whether this icon is stored as an iconhash

## ◆ is_image_data()

bool dpp::utility::icon::is_image_data | ( |  | ) | const

Check whether this icon is stored as an image.

See also
  image_data

Returns
  bool Whether this icon is stored as an image

## ◆ operator=() [1/4]

icon & dpp::utility::icon::operator= | ( | const iconhash & | hash | ) |

Assign to iconhash.

Parameters

  hash | Iconhash

## ◆ operator=() [2/4]

icon & dpp::utility::icon::operator= | ( | const image_data & | img | ) |

Assign to image.

Parameters

  img | Image

## ◆ operator=() [3/4]

icon & dpp::utility::icon::operator= | ( | iconhash && | hash | ) |

noexcept

Assign to iconhash.

Parameters

  hash | Iconhash

## ◆ operator=() [4/4]

icon & dpp::utility::icon::operator= | ( | image_data && | img | ) |

noexcept

Assign to image.

Parameters

  img | Image

## Member Data Documentation

## ◆ hash_or_data

std::variant<std::monostate, iconhash, image_data> dpp::utility::icon::hash_or_data

Iconhash received or image data for upload.

D++ Library version 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0