get a temporary Text class in place
This commit is contained in:
parent
db6fe2b115
commit
9adcd93fd3
1
src/core/Text.cc
Normal file
1
src/core/Text.cc
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "Text.h"
|
36
src/core/Text.h
Normal file
36
src/core/Text.h
Normal 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
|
Loading…
x
Reference in New Issue
Block a user