Start on PieceTable
This commit is contained in:
parent
7e8b5c0b64
commit
b30b6eb202
7
src/core/PieceTable.cc
Normal file
7
src/core/PieceTable.cc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "PieceTable.h"
|
||||||
|
|
||||||
|
PieceTable::PieceTable(const uint8_t * file_buffer, unsigned long file_buffer_size)
|
||||||
|
{
|
||||||
|
m_file_buffer = file_buffer;
|
||||||
|
m_file_buffer_size = file_buffer_size;
|
||||||
|
}
|
38
src/core/PieceTable.h
Normal file
38
src/core/PieceTable.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef PIECETABLE_H
|
||||||
|
#define PIECETABLE_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "PagedBuffer.h"
|
||||||
|
|
||||||
|
class PieceTable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct PieceDescriptor
|
||||||
|
{
|
||||||
|
uint32_t prev;
|
||||||
|
uint32_t next;
|
||||||
|
uint32_t start;
|
||||||
|
uint32_t length;
|
||||||
|
uint32_t n_chars;
|
||||||
|
uint32_t eol;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ChangeDescriptor
|
||||||
|
{
|
||||||
|
uint32_t piece_descriptor_index;
|
||||||
|
uint32_t from_val;
|
||||||
|
uint32_t to_val;
|
||||||
|
uint8_t attr_idx;
|
||||||
|
};
|
||||||
|
|
||||||
|
PieceTable(const uint8_t * file_buffer, unsigned long file_buffer_size);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const uint8_t * m_file_buffer;
|
||||||
|
unsigned long m_file_buffer_size;
|
||||||
|
PagedBuffer<uint8_t> m_append_buffer;
|
||||||
|
PagedBuffer<PieceDescriptor> m_piece_descriptors;
|
||||||
|
PagedBuffer<ChangeDescriptor> m_change_descriptors;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user