D++ (DPP)
C++ Discord API Bot Library
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...

+ Collaboration diagram for dpp::utility::icon:

Public Member Functions

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

Public Attributes

std::variant< std::monostate, iconhash, image_datahash_or_data
 Iconhash received or image data for upload. More...
 

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
hashIconhash

◆ operator=() [2/4]

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

Assign to image.

Parameters
imgImage

◆ operator=() [3/4]

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

Assign to iconhash.

Parameters
hashIconhash

◆ operator=() [4/4]

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

Assign to image.

Parameters
imgImage

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.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