From 9adcd93fd38d3b84724b36ac480819b160194063 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 29 Jun 2016 20:05:59 -0400 Subject: [PATCH] get a temporary Text class in place --- src/core/Text.cc | 1 + src/core/Text.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/core/Text.cc create mode 100644 src/core/Text.h 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