From 857035697e14042a9571a1a6aa0d50b479da036e Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Tue, 3 Aug 2021 12:17:48 +0200
Subject: [PATCH] DRAFT: Implement appending and getting properties

---
 include/caosdb/entity.h | 3 ---
 src/caosdb/entity.cpp   | 8 ++++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/caosdb/entity.h b/include/caosdb/entity.h
index cbdf073..edd2018 100644
--- a/include/caosdb/entity.h
+++ b/include/caosdb/entity.h
@@ -338,8 +338,6 @@ private:
  */
 class Properties {
 public:
-  // TODO(fspreck) Implementations needed (basically everything). See Parents
-  // container for inspiration.
   /**
    * Return the current size of the properties container.
    *
@@ -448,7 +446,6 @@ public:
   auto SetUnit(const std::string &unit) -> void;
   // Currently no references or lists.
   auto SetDatatype(const std::string &datatype) -> void;
-  // TODO(fspreck) this one is tricky. See AppendParent
   auto AppendProperty(const Property &property) -> void;
 
   auto AppendParent(const Parent &parent) -> void;
diff --git a/src/caosdb/entity.cpp b/src/caosdb/entity.cpp
index c54a150..22f0eff 100644
--- a/src/caosdb/entity.cpp
+++ b/src/caosdb/entity.cpp
@@ -141,6 +141,14 @@ auto Entity::AppendParent(const Parent &parent) -> void {
   this->parents.Append(parent);
 }
 
+[[nodiscard]] auto Entity::GetProperties() const -> const Properties & {
+  return properties;
+}
+
+auto Entity::AppendProperty(const Property &property) -> void {
+  this->properties.Append(property);
+}
+
 auto Entity::CreateProtoEntity() -> ProtoEntity * {
   return google::protobuf::Arena::CreateMessage<ProtoEntity>(get_arena());
 }
-- 
GitLab