From a98f2e8552a8554e406f8c0abb5e0fdf4397964b Mon Sep 17 00:00:00 2001 From: sha512sum Date: Thu, 7 Nov 2024 14:48:00 +0000 Subject: [PATCH] Remove pugixml dependency --- CMakeLists.txt | 6 ++---- library/include/larra/features.hpp | 4 +--- library/include/larra/stream.hpp | 2 -- library/src/stream.cpp | 28 ---------------------------- 4 files changed, 3 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4dfecd..b1728c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,8 +59,6 @@ CPMAddPackage( OPTIONS "BOOST_SKIP_INSTALL_RULES OFF" ) - -CPMAddPackage("gh:zeux/pugixml@1.14") CPMAddPackage("gh:fmtlib/fmt#10.2.1") CPMAddPackage(NAME nameof VERSION 0.10.4 @@ -177,13 +175,13 @@ target_include_directories(larra_xmpp PUBLIC if(TARGET Boost::pfr) target_link_libraries(larra_xmpp PUBLIC - Boost::asio Boost::serialization utempl::utempl pugixml::pugixml + Boost::asio Boost::serialization utempl::utempl OpenSSL::SSL nameof::nameof fmt::fmt OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES}) else() find_package(Boost 1.85.0 COMPONENTS serialization REQUIRED) target_link_libraries(larra_xmpp PUBLIC - utempl::utempl ${Boost_LIBRARIES} pugixml::pugixml OpenSSL::SSL + utempl::utempl ${Boost_LIBRARIES} OpenSSL::SSL nameof::nameof fmt::fmt OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES}) endif() diff --git a/library/include/larra/features.hpp b/library/include/larra/features.hpp index 0c99448..a8e0956 100644 --- a/library/include/larra/features.hpp +++ b/library/include/larra/features.hpp @@ -3,7 +3,6 @@ #include #include -#include #include namespace larra::xmpp { @@ -51,10 +50,9 @@ struct StreamFeatures { return utils::FieldSetHelper::With<"saslMechanisms">(std::forward(self), std::move(value)); } template - [[nodiscard]] constexpr auto Others(this Self&& self, std::vector value) { + [[nodiscard]] constexpr auto Others(this Self&& self, std::vector value) { return utils::FieldSetHelper::With<"others">(std::forward(self), std::move(value)); } - [[nodiscard]] static auto Parse(pugi::xml_node) -> StreamFeatures; [[nodiscard]] static auto Parse(const xmlpp::Element*) -> StreamFeatures; }; diff --git a/library/include/larra/stream.hpp b/library/include/larra/stream.hpp index e25b882..8ced13e 100644 --- a/library/include/larra/stream.hpp +++ b/library/include/larra/stream.hpp @@ -2,7 +2,6 @@ #include #include -#include namespace larra::xmpp { @@ -58,7 +57,6 @@ struct BasicStream { return node; } friend auto ToString(const BasicStream&) -> std::string; - static auto Parse(const pugi::xml_node& node) -> BasicStream; [[nodiscard]] static auto Parse(const xmlpp::Element*) -> BasicStream; }; diff --git a/library/src/stream.cpp b/library/src/stream.cpp index a4e5057..dbedfed 100644 --- a/library/src/stream.cpp +++ b/library/src/stream.cpp @@ -3,23 +3,10 @@ namespace { -inline auto ToOptionalString(const pugi::xml_attribute& attribute) -> std::optional { - return attribute ? std::optional{std::string{attribute.as_string()}} : std::nullopt; -} - inline auto ToOptionalString(const xmlpp::Attribute* attribute) -> std::optional { return attribute ? std::optional{std::string{attribute->get_value()}} : std::nullopt; } -template -inline auto ToOptionalUser(const pugi::xml_attribute& attribute) { - if constexpr(IsJid) { - return attribute ? std::optional{larra::xmpp::BareJid::Parse(attribute.as_string())} : std::nullopt; - } else { - return attribute ? std::optional{std::string{attribute.as_string()}} : std::nullopt; - } -} - template inline auto ToOptionalUser(const xmlpp::Attribute* attribute) { if constexpr(IsJid) { @@ -61,15 +48,6 @@ template auto ServerStream::SerializeStream(xmlpp::Element* node) const -> void; template auto ServerToUserStream::SerializeStream(xmlpp::Element* node) const -> void; template auto UserStream::SerializeStream(xmlpp::Element* node) const -> void; -template -auto impl::BasicStream::Parse(const pugi::xml_node& node) -> impl::BasicStream { - return {ToOptionalUser(node.attribute("from")), - ToOptionalUser(node.attribute("to")), - ToOptionalString(node.attribute("id")), - ToOptionalString(node.attribute("version")), - ToOptionalString(node.attribute("xml:lang"))}; -} - template auto impl::BasicStream::Parse(const xmlpp::Element* node) -> impl::BasicStream { return {ToOptionalUser(node->get_attribute("from")), @@ -78,12 +56,6 @@ auto impl::BasicStream::Parse(const xmlpp::Element* node) -> imp ToOptionalString(node->get_attribute("version")), ToOptionalString(node->get_attribute("lang", "xml"))}; } - -template auto UserStream::Parse(const pugi::xml_node& node) -> UserStream; - -template auto ServerStream::Parse(const pugi::xml_node& node) -> ServerStream; -template auto ServerToUserStream::Parse(const pugi::xml_node& node) -> ServerToUserStream; - template auto UserStream::Parse(const xmlpp::Element* node) -> UserStream; template auto ServerStream::Parse(const xmlpp::Element* node) -> ServerStream;