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.
|
| |
| constexpr | permission (uint64_t value) noexcept |
| | Bitmask constructor, initializes permission to the argument.
|
| |
| template<typename... T> |
| std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr | add (T... values) noexcept |
| | Add a permission with the Bitwise OR operation.
|
| |
| template<typename... T> |
| constexpr bool | can (T... values) const noexcept |
| | Check for certain permissions, taking into account administrator privileges. It uses the Bitwise AND operator.
|
| |
| template<typename... T> |
| constexpr bool | can_any (T... values) const noexcept |
| | Check for certain permissions, taking into account administrator privileges. It uses the Bitwise AND operator.
|
| |
| template<typename... T> |
| constexpr bool | has (T... values) const noexcept |
| | Check for permission flags set. It uses the Bitwise AND operator.
|
| |
| template<typename... T> |
| constexpr bool | has_any (T... values) const noexcept |
| | Check for permission flags set. It uses the Bitwise AND operator.
|
| |
| constexpr | operator uint64_t () const noexcept |
| | For acting like an integer.
|
| |
| constexpr | operator uint64_t & () noexcept |
| | For acting like an integer.
|
| |
| template<typename... T> |
| std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr | remove (T... values) noexcept |
| | Remove a permission with the Bitwise NOT operation.
|
| |
| template<typename... T> |
| std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr | set (T... values) noexcept |
| | Assign permissions. This will reset the bitmask to the new value.
|
| |
|
| uint64_t | value {0} |
| | The permission bitmask value.
|
| |
Represents a permission bitmask (refer to enum dpp::permissions) which are held in an uint64_t.
◆ permission() [1/2]
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>
| std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr 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:
Represents a permission bitmask (refer to enum dpp::permissions) which are held in an uint64_t.
Definition permissions.h:313
std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr add(T... values) noexcept
Add a permission with the Bitwise OR operation.
Definition permissions.h:446
@ p_view_channel
Allows guild members to view a channel, which includes reading messages in text channels and joining ...
Definition permissions.h:87
@ p_send_messages
Allows for sending messages in a channel.
Definition permissions.h:92
- Returns
- permission& reference to self for chaining
◆ can()
template<typename... T>
| constexpr bool dpp::permission::can |
( |
T... |
values | ) |
const |
|
inlineconstexprnoexcept |
Check for certain permissions, taking into account administrator privileges. It uses the Bitwise AND operator.
- Template Parameters
-
| T | one or more uint64_t permission bits |
- Parameters
-
Example:
constexpr bool can(T... values) const noexcept
Check for certain permissions, taking into account administrator privileges. It uses the Bitwise AND ...
Definition permissions.h:369
@ p_ban_members
Allows banning members.
Definition permissions.h:46
@ p_kick_members
Allows kicking members.
Definition permissions.h:41
auto run_once()
Run some code within an if() statement only once.
Definition once.h:41
- Returns
- bool True if it has all the given permissions or dpp::p_administrator
◆ can_any()
template<typename... T>
| constexpr bool dpp::permission::can_any |
( |
T... |
values | ) |
const |
|
inlineconstexprnoexcept |
Check for certain permissions, taking into account administrator privileges. It uses the Bitwise AND operator.
- Template Parameters
-
| T | one or more uint64_t permission bits |
- Parameters
-
Example:
constexpr bool can_any(T... values) const noexcept
Check for certain permissions, taking into account administrator privileges. It uses the Bitwise AND ...
Definition permissions.h:388
- Returns
- bool True if it has any of the given permissions or dpp::p_administrator
◆ 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:
constexpr bool has(T... values) const noexcept
Check for permission flags set. It uses the Bitwise AND operator.
Definition permissions.h:407
- Returns
- bool True if it has all the given permissions
◆ has_any()
template<typename... T>
| constexpr bool dpp::permission::has_any |
( |
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:
constexpr bool has_any(T... values) const noexcept
Check for permission flags set. It uses the Bitwise AND operator.
Definition permissions.h:426
@ p_administrator
Allows all permissions and bypasses channel permission overwrites.
Definition permissions.h:51
- Returns
- bool True if it has any of 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>
| std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr 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:
std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr remove(T... values) noexcept
Remove a permission with the Bitwise NOT operation.
Definition permissions.h:487
- Returns
- permission& reference to self for chaining
◆ set()
template<typename... T>
| std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr dpp::permission::set |
( |
T... |
values | ) |
|
|
inlineconstexprnoexcept |
Assign permissions. This will reset the bitmask to the new value.
- Template Parameters
-
| T | one or more uint64_t permission bits |
- Parameters
-
Example:
std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > constexpr set(T... values) noexcept
Assign permissions. This will reset the bitmask to the new value.
Definition permissions.h:466
- Returns
- permission& reference to self for chaining
◆ value
| uint64_t dpp::permission::value {0} |
|
protected |
The permission bitmask value.