Provides general purpose utilities.
More...
This module provides utilities that are general enough to not belong in a specific module.
std::string gears::utility::base64::decode |
( |
const std::string & |
str | ) |
|
|
inline |
Decodes a string from base64. If the input string is not in base64 then a gears::utility::invalid_base64
exception is thrown.
- Parameters
-
str | The base64 string to decode. |
- Exceptions
-
- Returns
- The decoded string
Definition at line 121 of file base64.hpp.
std::string gears::utility::base64::encode |
( |
const std::string & |
str | ) |
|
|
inline |
Encodes a string to base64. The string to encode is done byte by byte. Padding is done through character =
. The character for the 62nd index is + and the index for the 63rd index is /. There is no line limit imposed.
- Parameters
-
- Returns
- base64 encoded string.
Definition at line 62 of file base64.hpp.
template<typename T , typename... Args>
constexpr std::array<T, sizeof...(Args)> gears::utility::make_array |
( |
Args &&... |
args | ) |
|
Constructs an std::array
instance from the arguments provided of type T. This allows for quick generation of std::array
instances similar to raw C arrays.
auto arr = utility::make_array<int>(1, 2, 3, 4, 5, 6, 7, 8);
- Parameters
-
args | Arguments to store into the array. |
- Template Parameters
-
- Returns
- An
std::array
containing the elements provided.
Definition at line 67 of file utility/helpers.hpp.
template<typename T , typename... Args>
detail::unique_type<T>::single gears::utility::make_unique |
( |
Args &&... |
args | ) |
|
|
inlinedelete |
Constructs an std::unique_ptr
instance from the arguments provided. This is the same function as std::make_unique
which was added in C++14. Constructing a type with known bounds is forbidden.
- Parameters
-
args | Arguments to pass to the constructor of the type. |
size | The size of the array to construct. |
- Template Parameters
-
- Returns
- An
std::unique_ptr
containing the resource made.
Definition at line 85 of file utility/helpers.hpp.
template<typename T >
detail::unique_type<T>::array gears::utility::make_unique |
( |
size_t |
size | ) |
|
|
inline |