Represents a permission bitmask (refer to enum dpp::permissions) which are held in an uint64_t.
More...
#include <permissions.h>
|
constexpr | permission ()=default |
| Default constructor, initializes permission to 0. More...
|
|
constexpr | permission (uint64_t value) noexcept |
| Bitmask constructor, initializes permission to the argument. More...
|
|
constexpr | operator uint64_t () const noexcept |
| For acting like an integer. More...
|
|
constexpr | operator uint64_t & () noexcept |
| For acting like an integer. More...
|
|
template<typename... T> |
constexpr bool | has (T... values) const noexcept |
| Check for permission flags set. It uses the Bitwise AND operator. More...
|
|
template<typename... T> |
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > | add (T... values) noexcept |
| Add a permission with the Bitwise OR operation. More...
|
|
template<typename... T> |
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > | set (T... values) noexcept |
| Assign a permission. This will reset the bitmask to the new value. More...
|
|
template<typename... T> |
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > | remove (T... values) noexcept |
| Remove a permission with the Bitwise NOT operation. More...
|
|
Represents a permission bitmask (refer to enum dpp::permissions) which are held in an uint64_t.
◆ permission() [1/2]
constexpr dpp::permission::permission |
( |
| ) |
|
|
constexprdefault |
Default constructor, initializes permission to 0.
◆ permission() [2/2]
constexpr dpp::permission::permission |
( |
uint64_t |
value | ) |
|
|
inlineconstexprnoexcept |
Bitmask constructor, initializes permission to the argument.
- Parameters
-
value | The bitmask to initialize the permission to |
◆ add()
template<typename... T>
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > dpp::permission::add |
( |
T... |
values | ) |
|
|
inlineconstexprnoexcept |
Add a permission with the Bitwise OR operation.
- Template Parameters
-
T | one or more uint64_t permission bits |
- Parameters
-
Example:
constexpr permission()=default
Default constructor, initializes permission to 0.
@ p_view_channel
allows guild members to view a channel, which includes reading messages in text channels and joining ...
Definition: permissions.h:43
@ p_send_messages
allows for sending messages in a channel
Definition: permissions.h:44
- Returns
- permission& reference to self for chaining
◆ has()
template<typename... T>
constexpr bool dpp::permission::has |
( |
T... |
values | ) |
const |
|
inlineconstexprnoexcept |
Check for permission flags set. It uses the Bitwise AND operator.
- Template Parameters
-
T | one or more uint64_t permission bits |
- Parameters
-
Example:
@ p_ban_members
allows banning members
Definition: permissions.h:35
@ p_kick_members
allows kicking members
Definition: permissions.h:34
- Returns
- bool True if it has all the given permissions
◆ operator uint64_t()
constexpr dpp::permission::operator uint64_t |
( |
| ) |
const |
|
inlineconstexprnoexcept |
For acting like an integer.
- Returns
- The permission bitmask value
◆ operator uint64_t &()
constexpr dpp::permission::operator uint64_t & |
( |
| ) |
|
|
inlineconstexprnoexcept |
For acting like an integer.
- Returns
- A reference to the permission bitmask value
◆ remove()
template<typename... T>
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > dpp::permission::remove |
( |
T... |
values | ) |
|
|
inlineconstexprnoexcept |
Remove a permission with the Bitwise NOT operation.
- Template Parameters
-
T | one or more uint64_t permission bits |
- Parameters
-
Example:
- Returns
- permission& reference to self for chaining
◆ set()
template<typename... T>
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > dpp::permission::set |
( |
T... |
values | ) |
|
|
inlineconstexprnoexcept |
Assign a permission. This will reset the bitmask to the new value.
- Template Parameters
-
T | one or more uint64_t permission bits |
- Parameters
-
Example:
- Returns
- permission& reference to self for chaining
◆ value
uint64_t dpp::permission::value {0} |
|
protected |
The permission bitmask value.