jes/src/core/TextLoader.h
Josh Holtrop 65468bd2e5 Change TextLoader for gap buffer approach
- for CR line endings, convert all CR to LF
- for CRLF line endings, convert all CRLF to LF
2016-11-01 20:53:54 -04:00

32 lines
658 B
C++

#ifndef TEXTLOADER_H
#define TEXTLOADER_H
#include <stdint.h>
#include <list>
#include <memory>
#include "Span.h"
#include "LineEndings.h"
#include "Encoding.h"
class TextLoader
{
public:
TextLoader();
void load_buffer(uint8_t * buffer, size_t size, size_t * out_size);
size_t num_lines()
{
return m_num_lines;
}
LineEndings::Type get_line_endings() { return m_line_endings; }
Encoding::Type get_encoding() { return m_encoding; }
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;
size_t m_num_lines;
};
#endif