start refactoring to a lib version0

This commit is contained in:
2022-12-13 18:17:34 +01:00
parent a6e1efb314
commit 4430d73eec
2 changed files with 249 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#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