Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Order of initialization of the next block is important
- // - don't change unless you know what you are doing!
- uptr_type buffer;
- std::size_t buffer_size;
- char_type* lptr, rptr; // points to actual gap boundaries
- char_type* staging_lptr, staging_rptr; // points to represented gap
- std::size_t character_num;
- std::size_t codepoint_num;
- std::vector<char_type*> lines;
- gap_buffer::gap_buffer() :
- buffer(malloc(char_type[alloc_size] * sizeof(char_type), std::free)
- buffer_size(alloc_size),
- lptr(lptr_beg()), rptr(rptr_beg()),
- staging_lptr(lptr), staging_rptr(rptr),
- character_num(0),
- codepoint_num(0) {
- }
- gap_buffer::gap_buffer(const gap_buffer& other) :
- buffer(malloc(char_type[other.buffer_size] * sizeof(char_type)), std::free),
- lptr(other.lptr), rptr(other.rptr),
- staging_lptr(other.staging_lptr), staging_rptr(other.staging_rptr),
- buffer_size(other.buffer_size),
- character_num(other.character_num),
- codepoint_num(other.codepoint_num),
- lines(other.lines) {
- std::memcpy(lptr_beg(), other.lptr_beg(), lsize());
- std::memcpy(rptr, other.rptr, rsize());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement