get a temporary Text class in place

This commit is contained in:
Josh Holtrop 2016-06-29 20:05:59 -04:00
parent db6fe2b115
commit 9adcd93fd3
2 changed files with 37 additions and 0 deletions

1
src/core/Text.cc Normal file
View File

@ -0,0 +1 @@
#include "Text.h"

36
src/core/Text.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef TEXT_H
#define TEXT_H
#include <stdint.h>
#include <stdlib.h>
/**
* 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