All: rename every function from UpperCamelCase to snake_case

This was a mess since I didn't know which to use but now I decided
to go with snake_case :)
This commit is contained in:
Bananymous
2023-02-01 21:05:44 +02:00
parent 4faa662a59
commit 9b8de5025a
50 changed files with 737 additions and 709 deletions

View File

@@ -28,31 +28,31 @@ namespace BAN
LinkedList() = default;
~LinkedList();
[[nodiscard]] ErrorOr<void> PushBack(const T&);
[[nodiscard]] ErrorOr<void> PushBack(T&&);
[[nodiscard]] ErrorOr<void> Insert(const_iterator, const T&);
[[nodiscard]] ErrorOr<void> Insert(const_iterator, T&&);
[[nodiscard]] ErrorOr<void> push_back(const T&);
[[nodiscard]] ErrorOr<void> push_back(T&&);
[[nodiscard]] ErrorOr<void> insert(const_iterator, const T&);
[[nodiscard]] ErrorOr<void> insert(const_iterator, T&&);
template<typename... Args>
[[nodiscard]] ErrorOr<void> EmplaceBack(Args...);
[[nodiscard]] ErrorOr<void> emplace_back(Args...);
template<typename... Args>
[[nodiscard]] ErrorOr<void> Emplace(const_iterator, Args...);
[[nodiscard]] ErrorOr<void> emplace(const_iterator, Args...);
void PopBack();
void Remove(const_iterator);
void Clear();
void pop_back();
void remove(const_iterator);
void clear();
iterator begin() { return iterator(m_data, false); }
const_iterator begin() const { return const_iterator(m_data, false); }
iterator end() { return iterator(m_last, true); }
const_iterator end() const { return const_iterator(m_last, true); }
const T& Back() const;
T& Back();
const T& Front() const;
T& Front();
const T& back() const;
T& back();
const T& front() const;
T& front();
size_type Size() const;
bool Empty() const;
size_type size() const;
bool empty() const;
private:
struct Node
@@ -166,34 +166,34 @@ namespace BAN
template<typename T>
LinkedList<T>::~LinkedList()
{
Clear();
clear();
}
template<typename T>
ErrorOr<void> LinkedList<T>::PushBack(const T& value)
ErrorOr<void> LinkedList<T>::push_back(const T& value)
{
return PushBack(Move(T(value)));
return push_back(Move(T(value)));
}
template<typename T>
ErrorOr<void> LinkedList<T>::PushBack(T&& value)
ErrorOr<void> LinkedList<T>::push_back(T&& value)
{
return Insert(end(), Move(value));
return insert(end(), Move(value));
}
template<typename T>
ErrorOr<void> LinkedList<T>::Insert(const_iterator iter, const T& value)
ErrorOr<void> LinkedList<T>::insert(const_iterator iter, const T& value)
{
return Insert(iter, Move(T(value)));
return insert(iter, Move(T(value)));
}
template<typename T>
ErrorOr<void> LinkedList<T>::Insert(const_iterator iter, T&& value)
ErrorOr<void> LinkedList<T>::insert(const_iterator iter, T&& value)
{
Node* next = iter.m_past_end ? nullptr : iter.m_current;
Node* prev = next ? next->prev : m_last;
Node* new_node = TRY(allocate_node());
new (&new_node->value) T(Move(value));
new (&new_node->value) T(move(value));
new_node->next = next;
new_node->prev = prev;
(prev ? prev->next : m_data) = new_node;
@@ -204,19 +204,19 @@ namespace BAN
template<typename T>
template<typename... Args>
ErrorOr<void> LinkedList<T>::EmplaceBack(Args... args)
ErrorOr<void> LinkedList<T>::emplace_back(Args... args)
{
return Emplace(end(), Forward<Args>(args)...);
return emplace(end(), forward<Args>(args)...);
}
template<typename T>
template<typename... Args>
ErrorOr<void> LinkedList<T>::Emplace(const_iterator iter, Args... args)
ErrorOr<void> LinkedList<T>::emplace(const_iterator iter, Args... args)
{
Node* next = iter.m_past_end ? nullptr : iter.m_current;
Node* prev = next ? next->prev : m_last;
Node* new_node = TRY(allocate_node());
new (&new_node->value) T(Forward<Args>(args)...);
new (&new_node->value) T(forward<Args>(args)...);
new_node->next = next;
new_node->prev = prev;
(prev ? prev->next : m_data) = new_node;
@@ -226,13 +226,13 @@ namespace BAN
}
template<typename T>
void LinkedList<T>::PopBack()
void LinkedList<T>::pop_back()
{
return Remove(m_last);
return remove(m_last);
}
template<typename T>
void LinkedList<T>::Remove(const_iterator iter)
void LinkedList<T>::remove(const_iterator iter)
{
ASSERT(m_size > 0);
Node* node = iter.m_current;
@@ -246,7 +246,7 @@ namespace BAN
}
template<typename T>
void LinkedList<T>::Clear()
void LinkedList<T>::clear()
{
Node* ptr = m_data;
while (ptr)
@@ -262,41 +262,41 @@ namespace BAN
}
template<typename T>
const T& LinkedList<T>::Back() const
const T& LinkedList<T>::back() const
{
ASSERT(m_size > 0);
return *const_iterator(m_last);
}
template<typename T>
T& LinkedList<T>::Back()
T& LinkedList<T>::back()
{
ASSERT(m_size > 0);
return *iterator(m_last);
}
template<typename T>
const T& LinkedList<T>::Front() const
const T& LinkedList<T>::front() const
{
ASSERT(m_size > 0);
return *const_iterator(m_data);
}
template<typename T>
T& LinkedList<T>::Front()
T& LinkedList<T>::front()
{
ASSERT(m_size > 0);
return *iterator(m_data);
}
template<typename T>
typename LinkedList<T>::size_type LinkedList<T>::Size() const
typename LinkedList<T>::size_type LinkedList<T>::size() const
{
return m_size;
}
template<typename T>
bool LinkedList<T>::Empty() const
bool LinkedList<T>::empty() const
{
return m_size == 0;
}
@@ -306,7 +306,7 @@ namespace BAN
{
Node* node = (Node*)BAN::allocator(sizeof(Node));
if (node == nullptr)
return Error::FromString("LinkedList: Could not allocate memory");
return Error::from_string("LinkedList: Could not allocate memory");
return node;
}