rename BufferString to String
This commit is contained in:
parent
f2fd2b125a
commit
df0f7b4689
|
@ -23,7 +23,7 @@ T clamp(T min, T max, T val)
|
|||
}
|
||||
|
||||
Buffer::Buffer(const std::string& name, Type type,
|
||||
const BufferString& initial_content)
|
||||
const String& initial_content)
|
||||
: m_name(name), m_type(type),
|
||||
m_history(1), m_history_cursor(m_history.begin()),
|
||||
m_content(initial_content), m_last_save_undo_index(0)
|
||||
|
@ -122,7 +122,7 @@ BufferSize Buffer::line_count() const
|
|||
return m_lines.size();
|
||||
}
|
||||
|
||||
BufferString Buffer::string(const BufferIterator& begin, const BufferIterator& end) const
|
||||
String Buffer::string(const BufferIterator& begin, const BufferIterator& end) const
|
||||
{
|
||||
return m_content.substr(begin.m_position, end - begin);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class Window;
|
|||
typedef int BufferPos;
|
||||
typedef int BufferSize;
|
||||
typedef char BufferChar;
|
||||
typedef std::basic_string<BufferChar> BufferString;
|
||||
typedef std::basic_string<BufferChar> String;
|
||||
|
||||
struct BufferCoord : LineAndColumn<BufferCoord>
|
||||
{
|
||||
|
@ -81,17 +81,16 @@ struct Modification
|
|||
|
||||
Type type;
|
||||
BufferIterator position;
|
||||
BufferString content;
|
||||
String content;
|
||||
|
||||
Modification(Type type, BufferIterator position,
|
||||
const BufferString& content)
|
||||
Modification(Type type, BufferIterator position, const String& content)
|
||||
: type(type), position(position), content(content) {}
|
||||
|
||||
Modification inverse() const;
|
||||
|
||||
static Modification make_erase(BufferIterator begin, BufferIterator end);
|
||||
static Modification make_insert(BufferIterator position,
|
||||
const BufferString& content);
|
||||
const String& content);
|
||||
};
|
||||
|
||||
class ModificationListener
|
||||
|
@ -116,7 +115,7 @@ public:
|
|||
};
|
||||
|
||||
Buffer(const std::string& name, Type type,
|
||||
const BufferString& initial_content = "\n");
|
||||
const String& initial_content = "\n");
|
||||
Buffer(const Buffer&) = delete;
|
||||
Buffer(Buffer&&) = delete;
|
||||
Buffer& operator= (const Buffer&) = delete;
|
||||
|
@ -130,7 +129,7 @@ public:
|
|||
bool undo();
|
||||
bool redo();
|
||||
|
||||
BufferString string(const BufferIterator& begin,
|
||||
String string(const BufferIterator& begin,
|
||||
const BufferIterator& end) const;
|
||||
|
||||
BufferIterator begin() const;
|
||||
|
@ -146,7 +145,7 @@ public:
|
|||
|
||||
const std::string& name() const { return m_name; }
|
||||
|
||||
const BufferString& content() const { return m_content; }
|
||||
const String& content() const { return m_content; }
|
||||
|
||||
Window* get_or_create_window();
|
||||
void delete_window(Window* window);
|
||||
|
@ -179,7 +178,7 @@ private:
|
|||
BufferSize line_length(BufferPos line) const;
|
||||
void update_lines(const Modification& modification);
|
||||
|
||||
BufferString m_content;
|
||||
String m_content;
|
||||
|
||||
std::string m_name;
|
||||
const Type m_type;
|
||||
|
@ -207,7 +206,7 @@ inline Modification Modification::make_erase(BufferIterator begin,
|
|||
}
|
||||
|
||||
inline Modification Modification::make_insert(BufferIterator position,
|
||||
const BufferString& content)
|
||||
const String& content)
|
||||
{
|
||||
return Modification(Insert, position, content);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Kakoune
|
||||
{
|
||||
|
||||
BufferString DisplayAtom::content() const
|
||||
String DisplayAtom::content() const
|
||||
{
|
||||
if (m_replacement_text.empty())
|
||||
return m_begin.buffer().string(m_begin, m_end);
|
||||
|
@ -131,7 +131,7 @@ void DisplayBuffer::check_invariant() const
|
|||
}
|
||||
|
||||
void DisplayBuffer::replace_atom_content(iterator atom,
|
||||
const BufferString& replacement)
|
||||
const String& replacement)
|
||||
{
|
||||
atom->m_replacement_text = replacement;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ struct DisplayAtom
|
|||
Color& bg_color() { return m_bg_color; }
|
||||
Attribute& attribute() { return m_attribute; }
|
||||
|
||||
BufferString content() const;
|
||||
String content() const;
|
||||
DisplayCoord end_coord() const;
|
||||
BufferIterator iterator_at(const DisplayCoord& coord) const;
|
||||
DisplayCoord line_and_column_at(const BufferIterator& iterator) const;
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
Color m_fg_color;
|
||||
Color m_bg_color;
|
||||
Attribute m_attribute;
|
||||
BufferString m_replacement_text;
|
||||
String m_replacement_text;
|
||||
};
|
||||
|
||||
// A DisplayBuffer is the visual content of a Window as a DisplayAtom list
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
iterator insert(iterator where, const DisplayAtom& atom);
|
||||
iterator split(iterator atom, const BufferIterator& pos);
|
||||
|
||||
void replace_atom_content(iterator atom, const BufferString& replacement);
|
||||
void replace_atom_content(iterator atom, const String& replacement);
|
||||
|
||||
iterator begin() { return m_atoms.begin(); }
|
||||
iterator end() { return m_atoms.end(); }
|
||||
|
|
|
@ -26,7 +26,7 @@ void Editor::erase()
|
|||
}
|
||||
|
||||
template<bool append>
|
||||
static void do_insert(Editor& editor, const Editor::String& string)
|
||||
static void do_insert(Editor& editor, const String& string)
|
||||
{
|
||||
scoped_edition edition(editor);
|
||||
for (auto& sel : editor.selections())
|
||||
|
@ -37,7 +37,7 @@ static void do_insert(Editor& editor, const Editor::String& string)
|
|||
}
|
||||
|
||||
template<bool append>
|
||||
static void do_insert(Editor& editor, const memoryview<Editor::String>& strings)
|
||||
static void do_insert(Editor& editor, const memoryview<String>& strings)
|
||||
{
|
||||
if (strings.empty())
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ void Editor::replace(const std::string& string)
|
|||
insert(string);
|
||||
}
|
||||
|
||||
std::vector<Editor::String> Editor::selections_content() const
|
||||
std::vector<String> Editor::selections_content() const
|
||||
{
|
||||
std::vector<String> contents;
|
||||
for (auto& sel : selections())
|
||||
|
@ -324,7 +324,7 @@ void IncrementalInserter::apply(Modification&& modification) const
|
|||
m_editor.buffer().modify(std::move(modification));
|
||||
}
|
||||
|
||||
void IncrementalInserter::insert(const Editor::String& string)
|
||||
void IncrementalInserter::insert(const String& string)
|
||||
{
|
||||
for (auto& sel : m_editor.selections())
|
||||
apply(Modification::make_insert(sel.begin(), string));
|
||||
|
|
|
@ -19,7 +19,6 @@ class Register;
|
|||
class Editor
|
||||
{
|
||||
public:
|
||||
typedef BufferString String;
|
||||
typedef std::function<SelectionAndCaptures (const Selection&)> Selector;
|
||||
typedef std::function<SelectionAndCapturesList (const Selection&)> MultiSelector;
|
||||
|
||||
|
@ -110,7 +109,7 @@ public:
|
|||
IncrementalInserter(Editor& editor, Mode mode = Mode::Insert);
|
||||
~IncrementalInserter();
|
||||
|
||||
void insert(const Editor::String& string);
|
||||
void insert(const String& string);
|
||||
void insert(const Register& reg);
|
||||
void erase();
|
||||
void move_cursors(const BufferCoord& offset);
|
||||
|
|
|
@ -88,7 +88,7 @@ void write_buffer_to_file(const Buffer& buffer, const std::string& filename)
|
|||
if (fd == -1)
|
||||
throw file_access_error(filename, strerror(errno));
|
||||
|
||||
const BufferString& content = buffer.content();
|
||||
const String& content = buffer.content();
|
||||
ssize_t count = content.length() * sizeof(BufferChar);
|
||||
const char* ptr = content.c_str();
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
};
|
||||
|
||||
typedef std::vector<Selection> SelectionList;
|
||||
typedef std::vector<BufferString> CaptureList;
|
||||
typedef std::vector<String> CaptureList;
|
||||
|
||||
// Selections are often associated with a capture list
|
||||
// like when they are created from a regex match with
|
||||
|
|
|
@ -53,7 +53,7 @@ static DisplayCoord measure_string(Iterator begin, Iterator end)
|
|||
return result;
|
||||
}
|
||||
|
||||
static DisplayCoord measure_string(const Editor::String& string)
|
||||
static DisplayCoord measure_string(const String& string)
|
||||
{
|
||||
return measure_string(string.begin(), string.end());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user