99#include < string>
1010
1111namespace utils {
12+ /* *
13+ * @brief Returns the current date and time as a string in ISO 8601 format without using any separators except for
14+ * 'T' between the date and the time.
15+ * @return The current date and time string.
16+ */
1217 [[nodiscard]] std::string current_date_time_iso8601 ();
1318
19+ /* *
20+ * @brief Converts between big endian and little endian. This function is needed since not all compilers support
21+ * std::byteswap as of yet.
22+ * @tparam Integral The type of the value to convert.
23+ * @param value The value to convert.
24+ * @return The converted value.
25+ */
1426 template <std::integral Integral>
1527 [[nodiscard]] constexpr inline Integral byte_swap (Integral value) noexcept {
1628 // source: https://en.cppreference.com/w/cpp/numeric/byteswap
@@ -20,6 +32,12 @@ namespace utils {
2032 return std::bit_cast<Integral>(value_representation);
2133 }
2234
35+ /* *
36+ * @brief Converts from the machine's native byte order to little endian. On a little endian machine, this function
37+ * does return the input value.
38+ * @param value A value in the machine's native byte order.
39+ * @return The value in little endian.
40+ */
2341 [[nodiscard]] constexpr inline auto to_little_endian (std::integral auto value) {
2442 if constexpr (std::endian::native == std::endian::little) {
2543 return value;
@@ -28,6 +46,12 @@ namespace utils {
2846 }
2947 }
3048
49+ /* *
50+ * @brief Converts from little endian to the machine's native byte order. On a little endian machine, this function
51+ * does return the input value.
52+ * @param value A value in little endian.
53+ * @return The value in the machine's native byte order.
54+ */
3155 [[nodiscard]] constexpr inline auto from_little_endian (std::integral auto value) {
3256 return to_little_endian (value);
3357 }
0 commit comments