#ifndef TEXTLOADER_H #define TEXTLOADER_H #include #include #include #include "Span.h" class TextLoader { public: enum { LINE_ENDING_LF, LINE_ENDING_CR, LINE_ENDING_CRLF, LINE_ENDING_COUNT }; TextLoader(); void load_buffer(uint8_t * buffer, size_t size); size_t num_lines() { if (m_lines == nullptr) { return 0u; } else { return m_lines->size(); } } int get_line_endings() { return m_line_endings; } auto begin() { return m_lines->begin(); } auto end() { return m_lines->end(); } bool get_eol_at_eof() { return m_eol_at_eof; } protected: int m_line_endings; bool m_eol_at_eof; std::shared_ptr> m_lines; }; #endif