Forráskód Böngészése

Extended SerializableJSONState class

- added "setValue" method to SerializableJSONState class
Patrick-Laptop 4 éve
szülő
commit
14229d3f1c

+ 6 - 1
source/serialization/json/logic/SerializableJSONState.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-15
- * Changed:         2020-09-15
+ * Changed:         2020-09-16
  *
  * */
 
@@ -29,6 +29,11 @@ void ls_std::SerializableJSONState::unmarshal(const ls_std::byte_field &_data)
   this->value->setId(this->jsonObject["id"]);
 }
 
+void ls_std::SerializableJSONState::setValue(std::shared_ptr<State> _value)
+{
+  this->value = std::move(_value);
+}
+
 void ls_std::SerializableJSONState::_unmarshalExistingStateConnection(nlohmann::json _jsonObject)
 {
   std::shared_ptr<ls_std::StateConnection> stateConnection = this->value->getConnectedStates().at(_jsonObject["connectionId"]);

+ 7 - 1
source/serialization/json/logic/SerializableJSONState.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-15
- * Changed:         2020-09-15
+ * Changed:         2020-09-16
  *
  * */
 
@@ -23,9 +23,15 @@ namespace ls_std {
       explicit SerializableJSONState(std::shared_ptr<State> _value);
       ~SerializableJSONState() = default;
 
+      // implementation
+
       ls_std::byte_field marshal() override;
       void unmarshal(const ls_std::byte_field& _data) override;
 
+      // additional functionality
+
+      void setValue(std::shared_ptr<State> _value);
+
     private:
 
       nlohmann::json jsonObject {};