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...
|
|
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 bool | can (T... values) const noexcept |
| Check for certain permissions, taking into account administrator privileges. More...
|
|
template<typename... T> |
constexpr bool | can_any (T... values) const noexcept |
| Check for certain permissions, taking into account administrator privileges. More...
|
|
template<typename... T> |
constexpr bool | has (T... values) const noexcept |
| Check for permission flags set. More...
|
|
template<typename... T> |
constexpr bool | has_any (T... values) const noexcept |
| Check for permission flags set. 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 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...
|
|
template<typename... T> |
constexpr std::enable_if_t<(std::is_convertible_v< T, uint64_t > &&...), permission & > | set (T... values) noexcept |
| Assign permissions. 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:
- 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:
- Returns
- bool True if it has all the given permissions or dpp::p_administrator
References 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:
- 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:
- 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:
- 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>
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 permissions.
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.
The documentation for this class was generated from the following files: