C++: use std::string instead of std::string_view

...in a lot of places which are related to libyang-cpp and sysrepo-cpp,
but also in some code that's velia-specific.

Change-Id: I9fc567480cb34131c790c74f75b7238cc00e0e84
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/dependencies/+/7626
diff --git a/src/system/Firmware.cpp b/src/system/Firmware.cpp
index fa73455..4b5956c 100644
--- a/src/system/Firmware.cpp
+++ b/src/system/Firmware.cpp
@@ -7,6 +7,7 @@
 
 #include <regex>
 #include "Firmware.h"
+#include "utils/libyang.h"
 #include "utils/log.h"
 #include "utils/sysrepo.h"
 
@@ -81,7 +82,7 @@
         auto lock = updateSlotStatus();
 
         try {
-            auto source = std::string{input.findPath("url")->asTerm().valueStr()};
+            auto source = utils::getValueAsString(*input.findPath("url"));
             m_rauc->install(source);
         } catch (sdbus::Error& e) {
             m_log->warn("RAUC install error: '{}'", e.what());
@@ -94,7 +95,7 @@
     m_srSubscribeRPC = m_srSessionRPC.onRPCAction(CZECHLIGHT_SYSTEM_FIRMWARE_MODULE_PREFIX + "installation/install", cbRPC);
 
     ::sysrepo::RpcActionCb markSlotAs = [this](auto, auto, auto path, auto input, auto, auto, auto) {
-        auto bootName = std::string{input.parent()->findPath("name")->asTerm().valueStr()};
+        auto bootName = utils::getValueAsString(*input.parent()->findPath("name"));
         std::string action;
         if (path == CZECHLIGHT_SYSTEM_FIRMWARE_MODULE_PREFIX + "firmware-slot/set-active-after-reboot") {
             action = "active";
diff --git a/src/system/JournalUpload.cpp b/src/system/JournalUpload.cpp
index c051d72..e3c20e9 100644
--- a/src/system/JournalUpload.cpp
+++ b/src/system/JournalUpload.cpp
@@ -10,6 +10,7 @@
 #include <sysrepo-cpp/Enum.hpp>
 #include "JournalUpload.h"
 #include "utils/io.h"
+#include "utils/libyang.h"
 #include "utils/log.h"
 
 using namespace std::string_literals;
@@ -28,7 +29,7 @@
     std::string url;
 
     auto hostNode = data->findPath(UPLOAD_URL_CONTAINER + "/host"s);
-    auto hostValue = std::string{hostNode->asTerm().valueStr()};
+    auto hostValue = velia::utils::getValueAsString(*hostNode);
     auto isIpv6 = hostNode->asTerm().valueType().internalPluginId().find("ipv6") != std::string::npos;
 
     url += data->findPath(UPLOAD_URL_CONTAINER + "/protocol"s)->asTerm().valueStr();
@@ -41,7 +42,7 @@
     }
 
     url += ":";
-    url += std::string(data->findPath(UPLOAD_URL_CONTAINER + "/port"s)->asTerm().valueStr());
+    url += data->findPath(UPLOAD_URL_CONTAINER + "/port"s)->asTerm().valueStr();
 
     return url;
 }
diff --git a/src/system/LLDPCallback.cpp b/src/system/LLDPCallback.cpp
index 5eb1f3d..ca579b4 100644
--- a/src/system/LLDPCallback.cpp
+++ b/src/system/LLDPCallback.cpp
@@ -17,7 +17,7 @@
 {
 }
 
-sysrepo::ErrorCode LLDPCallback::operator()(sysrepo::Session session, uint32_t, std::string_view, std::optional<std::string_view> subXPath, std::optional<std::string_view> requestXPath, uint32_t, std::optional<libyang::DataNode>& output)
+sysrepo::ErrorCode LLDPCallback::operator()(sysrepo::Session session, uint32_t, const std::string&, const std::optional<std::string>& subXPath, const std::optional<std::string>& requestXPath, uint32_t, std::optional<libyang::DataNode>& output)
 {
     m_log->trace("operational data callback: subXPath {} request-XPath {}",
             subXPath ? *subXPath : "(none)", requestXPath ? *requestXPath : "(none)");
diff --git a/src/system/LLDPCallback.h b/src/system/LLDPCallback.h
index 16f6dc3..69f2772 100644
--- a/src/system/LLDPCallback.h
+++ b/src/system/LLDPCallback.h
@@ -20,7 +20,7 @@
 class LLDPCallback {
 public:
     explicit LLDPCallback(std::shared_ptr<LLDPDataProvider> lldp);
-    sysrepo::ErrorCode operator()(sysrepo::Session session, uint32_t subscriptionId, std::string_view moduleName, std::optional<std::string_view> subXPath, std::optional<std::string_view> requestXPath, uint32_t, std::optional<libyang::DataNode>& output);
+    sysrepo::ErrorCode operator()(sysrepo::Session session, uint32_t subscriptionId, const std::string& moduleName, const std::optional<std::string>& subXPath, const std::optional<std::string>& requestXPath, uint32_t, std::optional<libyang::DataNode>& output);
 
 private:
     velia::Log m_log;