diff --git a/src/core/Text.cc b/src/core/Text.cc new file mode 100644 index 0000000..db8c33a --- /dev/null +++ b/src/core/Text.cc @@ -0,0 +1 @@ +#include "Text.h" diff --git a/src/core/Text.h b/src/core/Text.h new file mode 100644 index 0000000..f6a59b3 --- /dev/null +++ b/src/core/Text.h @@ -0,0 +1,36 @@ +#ifndef TEXT_H +#define TEXT_H + +#include +#include + +/** + * Class representing text. This implementation is temporary and currently + * only supports read-only, ASCII text. It needs to be reimplemented to + * support UTF-8 and editing. + */ +class Text +{ +public: + Text(uint8_t const * ro_buffer, size_t ro_length) : + m_ro_buffer(ro_buffer), + m_ro_length(ro_length) + { + } + + uint8_t operator[](int idx) const + { + return m_ro_buffer[idx]; + } + + size_t size() const + { + return m_ro_length; + } + +protected: + uint8_t const * m_ro_buffer; + size_t m_ro_length; +}; + +#endif