Style fixes.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-09-24 21:02:22 +02:00
parent 2e93cd65c5
commit 74d7e23056
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
6 changed files with 16 additions and 11 deletions

View File

@ -7,8 +7,7 @@
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
/// \defgroup Asserts Asserts /// \defgroup Asserts Asserts
/// \brief Group of non-editable strings with faster hashing. /// \brief A set of assertion macros.
#ifndef NO_ASSERT #ifndef NO_ASSERT
/// @brief Asserts an expression is true. Throws an exception if the assertion fails. /// @brief Asserts an expression is true. Throws an exception if the assertion fails.

View File

@ -44,7 +44,8 @@ namespace ArbUt {
/// @brief Returns the stacktrace of the exception. /// @brief Returns the stacktrace of the exception.
/// @param depth The max number of stacks it should retrieve. /// @param depth The max number of stacks it should retrieve.
/// @param include_addr Whether or not the address should be shown if the line information could not be retrieved. /// @param include_addr Whether or not the address should be shown if the line information could not be
/// retrieved.
[[nodiscard]] std::string GetStacktrace([[maybe_unused]] size_t depth = 6, [[nodiscard]] std::string GetStacktrace([[maybe_unused]] size_t depth = 6,
[[maybe_unused]] bool include_addr = true) const { [[maybe_unused]] bool include_addr = true) const {
#if !WINDOWS #if !WINDOWS
@ -58,7 +59,8 @@ namespace ArbUt {
/// @brief Builds a string from a given stack. /// @brief Builds a string from a given stack.
/// @param stack The stack to build the string from. /// @param stack The stack to build the string from.
/// @param depth The max number of stacks it should retrieve. /// @param depth The max number of stacks it should retrieve.
/// @param include_addr Whether or not the address should be shown if the line information could not be retrieved. /// @param include_addr Whether or not the address should be shown if the line information could not be
/// retrieved.
static std::string BuildStacktraceFromStack(const backward::StackTrace& stack, size_t depth = 6, static std::string BuildStacktraceFromStack(const backward::StackTrace& stack, size_t depth = 6,
bool include_addr = true) { bool include_addr = true) {
if (stack.size() == 0) { if (stack.size() == 0) {

View File

@ -27,7 +27,7 @@ namespace ArbUt {
/// @brief Copy operator. /// @brief Copy operator.
inline BorrowedPtr<T>& operator=(const BorrowedPtr<T>& rhs) noexcept { inline BorrowedPtr<T>& operator=(const BorrowedPtr<T>& rhs) noexcept {
if(this == &rhs) if (this == &rhs)
return *this; return *this;
_raw = rhs._raw; _raw = rhs._raw;
return *this; return *this;

View File

@ -8,7 +8,8 @@
#include "BorrowedPtr.hpp" #include "BorrowedPtr.hpp"
namespace ArbUt { namespace ArbUt {
/// @brief Collection of pointers that is owned by the list. When the list exits scope, the destructor on all pointers will be called. /// @brief Collection of pointers that is owned by the list. When the list exits scope, the destructor on all
/// pointers will be called.
template <class ValueT> class UniquePtrList { template <class ValueT> class UniquePtrList {
private: private:
std::vector<ValueT*> _vector; std::vector<ValueT*> _vector;
@ -20,7 +21,8 @@ namespace ArbUt {
/// @brief Initialises a UniquePtrList from a std::vector of raw pointers. /// @brief Initialises a UniquePtrList from a std::vector of raw pointers.
/// @param vec A std::vector of raw pointers. /// @param vec A std::vector of raw pointers.
inline UniquePtrList(const std::vector<ValueT*>& vec) noexcept : _vector(vec) {} inline UniquePtrList(const std::vector<ValueT*>& vec) noexcept : _vector(vec) {}
/// @brief Initialises a UniquePtrList with a certain capacity reserved for use. This does not set immediate size. /// @brief Initialises a UniquePtrList with a certain capacity reserved for use. This does not set immediate
/// size.
/// @param capacity The desired capacity. /// @param capacity The desired capacity.
explicit inline UniquePtrList(size_t capacity) : _vector() { _vector.reserve(capacity); } explicit inline UniquePtrList(size_t capacity) : _vector() { _vector.reserve(capacity); }
/// @brief Initialises a UniquePtrList from a initialiser_list. /// @brief Initialises a UniquePtrList from a initialiser_list.
@ -55,7 +57,8 @@ namespace ArbUt {
#endif #endif
return _vector[index]; return _vector[index];
} }
/// @brief Returns a raw pointer at an index, and releases ownership. Proper handling of the memory is assumed to be done by the taker. /// @brief Returns a raw pointer at an index, and releases ownership. Proper handling of the memory is assumed
/// to be done by the taker.
/// @param index The index to get the pointer from. /// @param index The index to get the pointer from.
/// @return A raw pointer. /// @return A raw pointer.
ValueT* TakeOwnership(size_t index) { ValueT* TakeOwnership(size_t index) {
@ -71,7 +74,8 @@ namespace ArbUt {
_vector[indexA] = _vector[indexB]; _vector[indexA] = _vector[indexB];
_vector[indexB] = temp; _vector[indexB] = temp;
} }
/// @brief Sets a pointer to a certain index. If an item already existed at that index, it's destructor will be called. /// @brief Sets a pointer to a certain index. If an item already existed at that index, it's destructor will be
/// called.
/// @param index The index to set the pointer to. /// @param index The index to set the pointer to.
/// @param ptr The pointer to store. /// @param ptr The pointer to store.
void Set(size_t index, ValueT* ptr) { void Set(size_t index, ValueT* ptr) {

View File

@ -176,5 +176,4 @@ namespace ArbUt {
/// @fn ArbUt::SignalHandling::loaded() /// @fn ArbUt::SignalHandling::loaded()
/// @brief Whether or not the signal handler is loaded /// @brief Whether or not the signal handler is loaded
#endif // ARBUTILS_SIGNALHANDLING_HPP #endif // ARBUTILS_SIGNALHANDLING_HPP

View File

@ -62,7 +62,8 @@ namespace ArbUt {
/// @brief Copy operator /// @brief Copy operator
/// @param other Other StringView /// @param other Other StringView
StringView(const StringView& other) noexcept : BasicStringView(other._length, other._hash), _str(other._str) {} StringView(const StringView& other) noexcept : BasicStringView(other._length, other._hash), _str(other._str) {}
/// @brief Special constructor of stringview, specifically designed for use of conversion from StringViewLiteral to StringView. /// @brief Special constructor of stringview, specifically designed for use of conversion from StringViewLiteral
/// to StringView.
/// @param other Other StringView /// @param other Other StringView
/// @param c A null-terminated C string. /// @param c A null-terminated C string.
/// @param length The length of the C string. /// @param length The length of the C string.