Commit 243162a7 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: enable multi editors

parent 4dd7757c
Pipeline #11106 failed with stage
in 48 seconds
This diff is collapsed.
......@@ -248,6 +248,8 @@ class small_string
u8 size_;
public:
using iterator = char*;
using const_iterator = const char*;
using size_type = u8;
static_assert(length > size_t{ 1 } && length < size_t{ 254 });
......@@ -313,6 +315,14 @@ public:
return zero == size_;
}
constexpr void size(std::size_t sz) noexcept
{
if (sz <= capacity()) {
buffer_[sz] = '\0';
size_ = static_cast<u8>(sz);
}
}
constexpr std::size_t size() const noexcept
{
return size_;
......@@ -320,7 +330,7 @@ public:
constexpr std::size_t capacity() const noexcept
{
return length;
return length - 1;
}
constexpr void assign(const std::string_view str) noexcept
......@@ -364,6 +374,26 @@ public:
return buffer_;
}
constexpr iterator begin() noexcept
{
return buffer_;
}
constexpr iterator end() noexcept
{
return buffer_ + size_;
}
constexpr const_iterator begin() const noexcept
{
return buffer_;
}
constexpr const_iterator end() const noexcept
{
return buffer_ + size_;
}
constexpr bool operator==(const small_string& rhs) const noexcept
{
return std::strncmp(buffer_, rhs.buffer_, length) == 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment