mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
This commit is contained in:
parent
c11351ac50
commit
0dc9af5f7e
286 changed files with 3244 additions and 2424 deletions
62
AK/Vector.h
62
AK/Vector.h
|
@ -112,8 +112,16 @@ public:
|
|||
return m_outline_buffer;
|
||||
}
|
||||
|
||||
const T& at(int i) const { ASSERT(i >= 0 && i < m_size); return data()[i]; }
|
||||
T& at(int i) { ASSERT(i >= 0 && i < m_size); return data()[i]; }
|
||||
const T& at(int i) const
|
||||
{
|
||||
ASSERT(i >= 0 && i < m_size);
|
||||
return data()[i];
|
||||
}
|
||||
T& at(int i)
|
||||
{
|
||||
ASSERT(i >= 0 && i < m_size);
|
||||
return data()[i];
|
||||
}
|
||||
|
||||
const T& operator[](int i) const { return at(i); }
|
||||
T& operator[](int i) { return at(i); }
|
||||
|
@ -314,8 +322,16 @@ public:
|
|||
bool operator<(const Iterator& other) { return m_index < other.m_index; }
|
||||
bool operator>(const Iterator& other) { return m_index > other.m_index; }
|
||||
bool operator>=(const Iterator& other) { return m_index >= other.m_index; }
|
||||
Iterator& operator++() { ++m_index; return *this; }
|
||||
Iterator& operator--() { --m_index; return *this; }
|
||||
Iterator& operator++()
|
||||
{
|
||||
++m_index;
|
||||
return *this;
|
||||
}
|
||||
Iterator& operator--()
|
||||
{
|
||||
--m_index;
|
||||
return *this;
|
||||
}
|
||||
Iterator operator-(int value) { return { m_vector, m_index - value }; }
|
||||
Iterator operator+(int value) { return { m_vector, m_index + value }; }
|
||||
Iterator& operator=(const Iterator& other)
|
||||
|
@ -325,9 +341,14 @@ public:
|
|||
}
|
||||
T& operator*() { return m_vector[m_index]; }
|
||||
int operator-(const Iterator& other) { return m_index - other.m_index; }
|
||||
|
||||
private:
|
||||
friend class Vector;
|
||||
Iterator(Vector& vector, int index) : m_vector(vector), m_index(index) { }
|
||||
Iterator(Vector& vector, int index)
|
||||
: m_vector(vector)
|
||||
, m_index(index)
|
||||
{
|
||||
}
|
||||
Vector& m_vector;
|
||||
int m_index { 0 };
|
||||
};
|
||||
|
@ -342,8 +363,16 @@ public:
|
|||
bool operator<(const ConstIterator& other) { return m_index < other.m_index; }
|
||||
bool operator>(const ConstIterator& other) { return m_index > other.m_index; }
|
||||
bool operator>=(const ConstIterator& other) { return m_index >= other.m_index; }
|
||||
ConstIterator& operator++() { ++m_index; return *this; }
|
||||
ConstIterator& operator--() { --m_index; return *this; }
|
||||
ConstIterator& operator++()
|
||||
{
|
||||
++m_index;
|
||||
return *this;
|
||||
}
|
||||
ConstIterator& operator--()
|
||||
{
|
||||
--m_index;
|
||||
return *this;
|
||||
}
|
||||
ConstIterator operator-(int value) { return { m_vector, m_index - value }; }
|
||||
ConstIterator operator+(int value) { return { m_vector, m_index + value }; }
|
||||
ConstIterator& operator=(const ConstIterator& other)
|
||||
|
@ -353,9 +382,14 @@ public:
|
|||
}
|
||||
const T& operator*() const { return m_vector[m_index]; }
|
||||
int operator-(const ConstIterator& other) { return m_index - other.m_index; }
|
||||
|
||||
private:
|
||||
friend class Vector;
|
||||
ConstIterator(const Vector& vector, const int index) : m_vector(vector), m_index(index) { }
|
||||
ConstIterator(const Vector& vector, const int index)
|
||||
: m_vector(vector)
|
||||
, m_index(index)
|
||||
{
|
||||
}
|
||||
const Vector& m_vector;
|
||||
int m_index { 0 };
|
||||
};
|
||||
|
@ -377,8 +411,16 @@ private:
|
|||
T* slot(int i) { return &data()[i]; }
|
||||
const T* slot(int i) const { return &data()[i]; }
|
||||
|
||||
T* inline_buffer() { static_assert(inline_capacity > 0); return reinterpret_cast<T*>(m_inline_buffer_storage); }
|
||||
const T* inline_buffer() const { static_assert(inline_capacity > 0); return reinterpret_cast<const T*>(m_inline_buffer_storage); }
|
||||
T* inline_buffer()
|
||||
{
|
||||
static_assert(inline_capacity > 0);
|
||||
return reinterpret_cast<T*>(m_inline_buffer_storage);
|
||||
}
|
||||
const T* inline_buffer() const
|
||||
{
|
||||
static_assert(inline_capacity > 0);
|
||||
return reinterpret_cast<const T*>(m_inline_buffer_storage);
|
||||
}
|
||||
|
||||
int m_size { 0 };
|
||||
int m_capacity { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue