aboutsummaryrefslogtreecommitdiff
path: root/ui.qt/source/knowledgefragment.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-06-27 00:09:44 +0000
committerrtk0c <[email protected]>2022-06-27 00:09:44 +0000
commit753c26d320e894069157bd401f7779ad07073d7c (patch)
tree8dc49b0b68285396c6b619db6c1443b1ecc5abd5 /ui.qt/source/knowledgefragment.hpp
parent21aa12d231ab70529322bab325df8293da63dc8d (diff)
(From git) Initial Qt GUI setup
git-svn-id: file:///home/arch/svn/epistmool/trunk@2 71f44415-077c-4ad7-a976-72ddbf76608f
Diffstat (limited to 'ui.qt/source/knowledgefragment.hpp')
-rw-r--r--ui.qt/source/knowledgefragment.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/ui.qt/source/knowledgefragment.hpp b/ui.qt/source/knowledgefragment.hpp
new file mode 100644
index 0000000..533d99f
--- /dev/null
+++ b/ui.qt/source/knowledgefragment.hpp
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "fwd.hpp"
+
+#include <QDateTime>
+#include <cstddef>
+#include <vector>
+
+struct KnowledgeId
+{
+ size_t id;
+};
+
+class KnowledgeFragment
+{
+private:
+ QDateTime createTime;
+ QDateTime modifyTime;
+ KnowledgeId id;
+
+public:
+ KnowledgeFragment(KnowledgeId id);
+
+ KnowledgeId getId() const;
+};
+
+class KnowledgeDatabase
+{
+private:
+ std::vector<KnowledgeFragment> storage;
+ std::vector<size_t> index; // Mapping from KnowledgeId (index) to `storage` index
+ KnowledgeId nextId;
+
+public:
+ KnowledgeId allocateFragment();
+ bool deleteFragment(KnowledgeId id);
+ KnowledgeFragment* getFragment(KnowledgeId id);
+};