From ca141b37cd1b1b8dbceec430f398fcdbca8f1676 Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Wed, 8 Feb 2023 15:24:34 +0100
Subject: [PATCH] read nullopt

---
 .../NlohmannJSONReaderWithoutTypeCheck.cpp          | 13 +++++++++++++
 .../NlohmannJSONReaderWithoutTypeCheck.h            |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.cpp b/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.cpp
index e773c517d..adebe0711 100644
--- a/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.cpp
+++ b/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.cpp
@@ -104,4 +104,17 @@ namespace armarx::aron::data::reader
     {
         i = input;
     }
+    bool
+    NlohmannJSONReaderWithoutTypeCheck::readNull(InputType& input) // defaulted implementation
+    {
+        try
+        {
+            const std::string e = input;
+            return e == "nullopt";
+        }
+        catch (...)
+        {
+            return false;
+        }
+    }
 } // namespace armarx::aron::data::reader
diff --git a/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.h b/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.h
index e0bed7b71..f109fa279 100644
--- a/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.h
+++ b/source/RobotAPI/libraries/aron/core/data/rw/reader/nlohmannJSON/NlohmannJSONReaderWithoutTypeCheck.h
@@ -69,5 +69,7 @@ namespace armarx::aron::data::reader
         void readDouble(InputType& input, double& i, Path& p) override;
         void readString(InputType& input, std::string& i, Path& p) override;
         void readBool(InputType& input, bool& i, Path& p) override;
+
+        bool readNull(InputType& input) override;
     };
 } // namespace armarx::aron::data::reader
-- 
GitLab