From d4a84125ef4d23f2c3e0b2eed5f6efbdc88af141 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 3 Oct 2014 13:39:13 +0100 Subject: Use InternedStrings for buffer contents --- src/buffer.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/buffer.hh') diff --git a/src/buffer.hh b/src/buffer.hh index e24bc786..01504170 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -6,7 +6,7 @@ #include "option_manager.hh" #include "keymap_manager.hh" #include "safe_ptr.hh" -#include "string.hh" +#include "interned_string.hh" #include "value.hh" #include @@ -92,7 +92,7 @@ public: bool set_name(String name); - BufferIterator insert(const BufferIterator& pos, String content); + BufferIterator insert(const BufferIterator& pos, StringView content); BufferIterator erase(BufferIterator begin, BufferIterator end); size_t timestamp() const; @@ -126,7 +126,7 @@ public: BufferIterator end() const; LineCount line_count() const; - const String& operator[](LineCount line) const + const StringView& operator[](LineCount line) const { return m_lines[line]; } // returns an iterator at given coordinates. clamp line_and_column @@ -178,15 +178,15 @@ private: void on_option_changed(const Option& option) override; - struct LineList : std::vector + struct LineList : std::vector { [[gnu::always_inline]] - String& operator[](LineCount line) - { return std::vector::operator[]((int)line); } + InternedString& operator[](LineCount line) + { return std::vector::operator[]((int)line); } [[gnu::always_inline]] - const String& operator[](LineCount line) const - { return std::vector::operator[]((int)line); } + const InternedString& operator[](LineCount line) const + { return std::vector::operator[]((int)line); } }; LineList m_lines; -- cgit v1.2.3