summaryrefslogtreecommitdiff
path: root/AK/ByteBuffer.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-12-21 02:10:45 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-12-21 02:10:45 +0100
commitec1c487dcd7de331d17d9c9ccc21dfbfa00dd4c8 (patch)
tree797d0ec90846ece3c658d55f1507585c85d0b91f /AK/ByteBuffer.h
parent89040cdc99d56e0a1a80b972db18d231c155ace0 (diff)
downloadserenity-ec1c487dcd7de331d17d9c9ccc21dfbfa00dd4c8.zip
Yet another pass of style fixes.
Diffstat (limited to 'AK/ByteBuffer.h')
-rw-r--r--AK/ByteBuffer.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h
index b005deefe7..62075563e6 100644
--- a/AK/ByteBuffer.h
+++ b/AK/ByteBuffer.h
@@ -30,8 +30,7 @@ public:
return *this;
}
- static ByteBuffer createEmpty() { return ByteBuffer(Buffer<byte>::createUninitialized(0)); }
- static ByteBuffer createUninitialized(size_t size) { return ByteBuffer(Buffer<byte>::createUninitialized(size)); }
+ static ByteBuffer create_uninitialized(size_t size) { return ByteBuffer(Buffer<byte>::create_uninitialized(size)); }
static ByteBuffer copy(const byte* data, size_t size) { return ByteBuffer(Buffer<byte>::copy(data, size)); }
static ByteBuffer wrap(byte* data, size_t size) { return ByteBuffer(Buffer<byte>::wrap(data, size)); }
static ByteBuffer adopt(byte* data, size_t size) { return ByteBuffer(Buffer<byte>::adopt(data, size)); }
@@ -39,22 +38,22 @@ public:
~ByteBuffer() { clear(); }
void clear() { m_impl = nullptr; }
- operator bool() const { return !isNull(); }
- bool operator!() const { return isNull(); }
- bool isNull() const { return m_impl == nullptr; }
+ operator bool() const { return !is_null(); }
+ bool operator!() const { return is_null(); }
+ bool is_null() const { return m_impl == nullptr; }
byte& operator[](size_t i) { ASSERT(m_impl); return (*m_impl)[i]; }
byte operator[](size_t i) const { ASSERT(m_impl); return (*m_impl)[i]; }
- bool isEmpty() const { return !m_impl || m_impl->isEmpty(); }
+ bool is_empty() const { return !m_impl || m_impl->is_empty(); }
size_t size() const { return m_impl ? m_impl->size() : 0; }
byte* pointer() { return m_impl ? m_impl->pointer() : nullptr; }
const byte* pointer() const { return m_impl ? m_impl->pointer() : nullptr; }
- byte* offsetPointer(size_t offset) { return m_impl ? m_impl->offsetPointer(offset) : nullptr; }
- const byte* offsetPointer(size_t offset) const { return m_impl ? m_impl->offsetPointer(offset) : nullptr; }
+ byte* offset_pointer(size_t offset) { return m_impl ? m_impl->offset_pointer(offset) : nullptr; }
+ const byte* offset_pointer(size_t offset) const { return m_impl ? m_impl->offset_pointer(offset) : nullptr; }
- const void* endPointer() const { return m_impl ? m_impl->endPointer() : nullptr; }
+ const void* end_pointer() const { return m_impl ? m_impl->end_pointer() : nullptr; }
// NOTE: trim() does not reallocate.
void trim(size_t size)
@@ -65,13 +64,13 @@ public:
ByteBuffer slice(size_t offset, size_t size) const
{
- if (isNull())
+ if (is_null())
return { };
if (offset >= this->size())
return { };
if (offset + size >= this->size())
size = this->size() - offset;
- return copy(offsetPointer(offset), size);
+ return copy(offset_pointer(offset), size);
}
private: