From df761748b0fdf3ffcb165f9c8b86b302210000bd Mon Sep 17 00:00:00 2001 From: sha512sum Date: Sat, 31 Aug 2024 10:44:53 +0000 Subject: [PATCH] Use more correct setters in streams and jid --- library/include/larra/jid.hpp | 14 +++++++------- library/include/larra/stream.hpp | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/library/include/larra/jid.hpp b/library/include/larra/jid.hpp index 10ce152..bd7408f 100644 --- a/library/include/larra/jid.hpp +++ b/library/include/larra/jid.hpp @@ -14,12 +14,12 @@ struct BareJid { template [[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid { - return utils::FieldSetHelper::With<"username">(std::forward(self), std::move(username)); + return utils::FieldSetHelper::With<"username", BareJid>(std::forward(self), std::move(username)); } template [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid { - return utils::FieldSetHelper::With<"server">(std::forward(self), std::move(server)); + return utils::FieldSetHelper::With<"server", BareJid>(std::forward(self), std::move(server)); } }; @@ -31,12 +31,12 @@ struct BareResourceJid { template [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid { - return utils::FieldSetHelper::With<"server">(std::forward(self), std::move(server)); + return utils::FieldSetHelper::With<"server", BareResourceJid>(std::forward(self), std::move(server)); } template [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid { - return utils::FieldSetHelper::With<"resource">(std::forward(self), std::move(resource)); + return utils::FieldSetHelper::With<"resource", BareResourceJid>(std::forward(self), std::move(resource)); } }; @@ -49,17 +49,17 @@ struct FullJid { template [[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid { - return utils::FieldSetHelper::With<"username">(std::forward(self), std::move(username)); + return utils::FieldSetHelper::With<"username", FullJid>(std::forward(self), std::move(username)); }; template [[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid { - return utils::FieldSetHelper::With<"server">(std::forward(self), std::move(server)); + return utils::FieldSetHelper::With<"server", FullJid>(std::forward(self), std::move(server)); }; template [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid { - return utils::FieldSetHelper::With<"resource">(std::forward(self), std::move(resource)); + return utils::FieldSetHelper::With<"resource", FullJid>(std::forward(self), std::move(resource)); }; }; diff --git a/library/include/larra/stream.hpp b/library/include/larra/stream.hpp index 3b824f9..ac8497e 100644 --- a/library/include/larra/stream.hpp +++ b/library/include/larra/stream.hpp @@ -19,32 +19,32 @@ struct BasicStream { std::optional xmlLang; template - constexpr auto From(this Self&& self, FromType value) { - return utils::FieldSetHelper::With<"from">(std::forward(self), std::move(value)); + constexpr auto From(this Self&& self, FromType value) -> BasicStream { + return utils::FieldSetHelper::With<"from", BasicStream>(std::forward(self), std::move(value)); }; template - constexpr auto To(this Self&& self, ToType value) { - return utils::FieldSetHelper::With<"to">(std::forward(self), std::move(value)); + constexpr auto To(this Self&& self, ToType value) -> BasicStream { + return utils::FieldSetHelper::With<"to", BasicStream>(std::forward(self), std::move(value)); }; template - constexpr auto Id(this Self&& self, std::optional value) { - return utils::FieldSetHelper::With<"id">(std::forward(self), std::move(value)); + constexpr auto Id(this Self&& self, std::optional value) -> BasicStream { + return utils::FieldSetHelper::With<"id", BasicStream>(std::forward(self), std::move(value)); }; template - constexpr auto Version(this Self&& self, std::optional value) { - return utils::FieldSetHelper::With<"version">(std::forward(self), std::move(value)); + constexpr auto Version(this Self&& self, std::optional value) -> BasicStream { + return utils::FieldSetHelper::With<"version", BasicStream>(std::forward(self), std::move(value)); }; template - constexpr auto XmlLang(this Self&& self, std::optional value) { - return utils::FieldSetHelper::With<"xmlLang">(std::forward_like(self), std::move(value)); + constexpr auto XmlLang(this Self&& self, std::optional value) -> BasicStream { + return utils::FieldSetHelper::With<"xmlLang", BasicStream>(std::forward_like(self), std::move(value)); }; auto SerializeStream(pugi::xml_node& node) const -> void; - friend auto operator<<(pugi::xml_node& node, const BasicStream& stream) -> pugi::xml_node& { + friend auto operator<<(pugi::xml_node& node, const BasicStream& stream) -> pugi::xml_node& { return (stream.SerializeStream(node), node); }; static auto Parse(const pugi::xml_node& node) -> BasicStream;