crdt_tests/version0/text_document.hpp
2022-12-13 19:15:38 +01:00

34 lines
468 B
C++

#pragma once
#include "./list.hpp"
namespace GreenCRDT {
template<typename AgentType>
struct TextDocument {
// TODO: determine if char is the best
using ListType = List<char, AgentType>;
struct Cursor {
AgentType who;
typename ListType::ListID pos;
};
ListType state;
std::string getText(void) {
std::string text;
for (const auto& it : state.list) {
if (it.value) {
text += it.value.value();
}
}
return text;
}
};
} // GreenCRDT