Change TextLoader for gap buffer approach
- for CR line endings, convert all CR to LF - for CRLF line endings, convert all CRLF to LF
This commit is contained in:
1 parent
1f3ecf950f
commit
65468bd2e5
3 files changed
+85
-63
No files matched your search
+3
-12
@@ -12,29 +12,20 @@ class TextLoader
|
||||
{
|
||||
public:
|
||||
TextLoader();
|
||||
void load_buffer(uint8_t * buffer, size_t size);
|
||||
void load_buffer(uint8_t * buffer, size_t size, size_t * out_size);
|
||||
size_t num_lines()
|
||||
{
|
||||
if (m_lines == nullptr)
|
||||
{
|
||||
return 0u;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_lines->size();
|
||||
}
|
||||
return m_num_lines;
|
||||
}
|
||||
LineEndings::Type get_line_endings() { return m_line_endings; }
|
||||
Encoding::Type get_encoding() { return m_encoding; }
|
||||
auto begin() { return m_lines->begin(); }
|
||||
auto end() { return m_lines->end(); }
|
||||
bool get_eol_at_eof() { return m_eol_at_eof; }
|
||||
|
||||
protected:
|
||||
LineEndings::Type m_line_endings;
|
||||
Encoding::Type m_encoding;
|
||||
bool m_eol_at_eof;
|
||||
std::shared_ptr<std::list<Span>> m_lines;
|
||||
size_t m_num_lines;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user