This commit is contained in:
parent
853aa2784c
commit
34bc3b759e
14
support/3rd_party/include/utils/common.hpp
vendored
14
support/3rd_party/include/utils/common.hpp
vendored
@ -84,11 +84,15 @@ get_next_available_port(std::uint16_t first_port,
|
|||||||
|
|
||||||
[[nodiscard]] auto resolve_variables(std::wstring_view str) -> std::wstring;
|
[[nodiscard]] auto resolve_variables(std::wstring_view str) -> std::wstring;
|
||||||
|
|
||||||
// template implementations
|
template <typename result_t, typename data_t>
|
||||||
template <typename val_t>
|
[[nodiscard]] inline constexpr auto
|
||||||
[[nodiscard]] inline auto divide_with_ceiling(const val_t &n,
|
divide_with_ceiling(result_t numerator, data_t denominator) -> result_t {
|
||||||
const val_t &d) -> val_t {
|
static_assert(std::is_integral_v<std::remove_cv_t<data_t>>,
|
||||||
return n ? (n / d) + (n % d != 0) : 0;
|
"denominator must be an integral type");
|
||||||
|
|
||||||
|
return denominator == 0
|
||||||
|
? 0
|
||||||
|
: (numerator / denominator) + (numerator % denominator != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PROJECT_ENABLE_LIBSODIUM)
|
#if defined(PROJECT_ENABLE_LIBSODIUM)
|
||||||
|
8
support/3rd_party/include/utils/config.hpp
vendored
8
support/3rd_party/include/utils/config.hpp
vendored
@ -287,6 +287,14 @@ extern "C" {
|
|||||||
#define statfs64 statfs
|
#define statfs64 statfs
|
||||||
#endif // !defined(statfs64)
|
#endif // !defined(statfs64)
|
||||||
|
|
||||||
|
#if !defined(off64_t)
|
||||||
|
#define off64_t std::size_t
|
||||||
|
#endif // !defined(off64_t)
|
||||||
|
|
||||||
|
#if !defined(__off64_t)
|
||||||
|
#define __off64_t off64_t
|
||||||
|
#endif // !defined(__off64_t)
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
using data_buffer = std::vector<unsigned char>;
|
using data_buffer = std::vector<unsigned char>;
|
||||||
using mutex_lock = std::lock_guard<std::mutex>;
|
using mutex_lock = std::lock_guard<std::mutex>;
|
||||||
|
9
support/3rd_party/include/utils/string.hpp
vendored
9
support/3rd_party/include/utils/string.hpp
vendored
@ -162,6 +162,9 @@ template <typename string_t>
|
|||||||
|
|
||||||
[[nodiscard]] auto to_utf8(std::wstring_view str) -> std::string;
|
[[nodiscard]] auto to_utf8(std::wstring_view str) -> std::string;
|
||||||
|
|
||||||
|
template <typename string_t>
|
||||||
|
[[nodiscard]] inline auto zero_pad(string_t str, std::size_t count) -> string_t;
|
||||||
|
|
||||||
template <typename string_t> struct chain_replace_with_hex final {
|
template <typename string_t> struct chain_replace_with_hex final {
|
||||||
explicit chain_replace_with_hex(string_t &value) : str(value) {}
|
explicit chain_replace_with_hex(string_t &value) : str(value) {}
|
||||||
|
|
||||||
@ -455,6 +458,12 @@ inline auto split(std::wstring_view str, std::wstring_view delim,
|
|||||||
bool should_trim) -> std::vector<std::wstring> {
|
bool should_trim) -> std::vector<std::wstring> {
|
||||||
return split_t<std::wstring>(str, delim, should_trim);
|
return split_t<std::wstring>(str, delim, should_trim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename string_t>
|
||||||
|
inline auto zero_pad(string_t str, std::size_t count) -> string_t {
|
||||||
|
str.insert(str.begin(), count - str.length(), '0');
|
||||||
|
return str;
|
||||||
|
}
|
||||||
} // namespace repertory::utils::string
|
} // namespace repertory::utils::string
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_UTILS_STRING_HPP_
|
#endif // REPERTORY_INCLUDE_UTILS_STRING_HPP_
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
||||||
|
|
||||||
#include "gtest/gtest.hpp"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "utils/collection.hpp"
|
#include "utils/collection.hpp"
|
||||||
#include "utils/encrypt.hpp"
|
#include "utils/encrypt.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user