Remove pugixml dependency
All checks were successful
PR Check / on-push-commit-check (push) Successful in 10m25s

This commit is contained in:
sha512sum 2024-11-07 14:48:00 +00:00
parent eda4f818a9
commit a98f2e8552
4 changed files with 3 additions and 37 deletions

View file

@ -59,8 +59,6 @@ CPMAddPackage(
OPTIONS "BOOST_SKIP_INSTALL_RULES OFF" OPTIONS "BOOST_SKIP_INSTALL_RULES OFF"
) )
CPMAddPackage("gh:zeux/pugixml@1.14")
CPMAddPackage("gh:fmtlib/fmt#10.2.1") CPMAddPackage("gh:fmtlib/fmt#10.2.1")
CPMAddPackage(NAME nameof CPMAddPackage(NAME nameof
VERSION 0.10.4 VERSION 0.10.4
@ -177,13 +175,13 @@ target_include_directories(larra_xmpp PUBLIC
if(TARGET Boost::pfr) if(TARGET Boost::pfr)
target_link_libraries(larra_xmpp PUBLIC 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::SSL nameof::nameof fmt::fmt
OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES}) OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES})
else() else()
find_package(Boost 1.85.0 COMPONENTS serialization REQUIRED) find_package(Boost 1.85.0 COMPONENTS serialization REQUIRED)
target_link_libraries(larra_xmpp PUBLIC target_link_libraries(larra_xmpp PUBLIC
utempl::utempl ${Boost_LIBRARIES} pugixml::pugixml OpenSSL::SSL utempl::utempl ${Boost_LIBRARIES} OpenSSL::SSL
nameof::nameof fmt::fmt nameof::nameof fmt::fmt
OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES}) OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES})
endif() endif()

View file

@ -3,7 +3,6 @@
#include <larra/utils.hpp> #include <larra/utils.hpp>
#include <optional> #include <optional>
#include <pugixml.hpp>
#include <vector> #include <vector>
namespace larra::xmpp { namespace larra::xmpp {
@ -51,10 +50,9 @@ struct StreamFeatures {
return utils::FieldSetHelper::With<"saslMechanisms">(std::forward<Self>(self), std::move(value)); return utils::FieldSetHelper::With<"saslMechanisms">(std::forward<Self>(self), std::move(value));
} }
template <typename Self> template <typename Self>
[[nodiscard]] constexpr auto Others(this Self&& self, std::vector<pugi::xml_node> value) { [[nodiscard]] constexpr auto Others(this Self&& self, std::vector<const xmlpp::Node*> value) {
return utils::FieldSetHelper::With<"others">(std::forward<Self>(self), std::move(value)); return utils::FieldSetHelper::With<"others">(std::forward<Self>(self), std::move(value));
} }
[[nodiscard]] static auto Parse(pugi::xml_node) -> StreamFeatures;
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> StreamFeatures; [[nodiscard]] static auto Parse(const xmlpp::Element*) -> StreamFeatures;
}; };

View file

@ -2,7 +2,6 @@
#include <libxml++/libxml++.h> #include <libxml++/libxml++.h>
#include <larra/jid.hpp> #include <larra/jid.hpp>
#include <pugixml.hpp>
namespace larra::xmpp { namespace larra::xmpp {
@ -58,7 +57,6 @@ struct BasicStream {
return node; return node;
} }
friend auto ToString(const BasicStream<JidFrom, JidTo>&) -> std::string; friend auto ToString(const BasicStream<JidFrom, JidTo>&) -> std::string;
static auto Parse(const pugi::xml_node& node) -> BasicStream<JidFrom, JidTo>;
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> BasicStream; [[nodiscard]] static auto Parse(const xmlpp::Element*) -> BasicStream;
}; };

View file

@ -3,23 +3,10 @@
namespace { namespace {
inline auto ToOptionalString(const pugi::xml_attribute& attribute) -> std::optional<std::string> {
return attribute ? std::optional{std::string{attribute.as_string()}} : std::nullopt;
}
inline auto ToOptionalString(const xmlpp::Attribute* attribute) -> std::optional<std::string> { inline auto ToOptionalString(const xmlpp::Attribute* attribute) -> std::optional<std::string> {
return attribute ? std::optional{std::string{attribute->get_value()}} : std::nullopt; return attribute ? std::optional{std::string{attribute->get_value()}} : std::nullopt;
} }
template <bool IsJid>
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 <bool IsJid> template <bool IsJid>
inline auto ToOptionalUser(const xmlpp::Attribute* attribute) { inline auto ToOptionalUser(const xmlpp::Attribute* attribute) {
if constexpr(IsJid) { 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 ServerToUserStream::SerializeStream(xmlpp::Element* node) const -> void;
template auto UserStream::SerializeStream(xmlpp::Element* node) const -> void; template auto UserStream::SerializeStream(xmlpp::Element* node) const -> void;
template <bool JidFrom, bool JidTo>
auto impl::BasicStream<JidFrom, JidTo>::Parse(const pugi::xml_node& node) -> impl::BasicStream<JidFrom, JidTo> {
return {ToOptionalUser<JidFrom>(node.attribute("from")),
ToOptionalUser<JidTo>(node.attribute("to")),
ToOptionalString(node.attribute("id")),
ToOptionalString(node.attribute("version")),
ToOptionalString(node.attribute("xml:lang"))};
}
template <bool JidFrom, bool JidTo> template <bool JidFrom, bool JidTo>
auto impl::BasicStream<JidFrom, JidTo>::Parse(const xmlpp::Element* node) -> impl::BasicStream<JidFrom, JidTo> { auto impl::BasicStream<JidFrom, JidTo>::Parse(const xmlpp::Element* node) -> impl::BasicStream<JidFrom, JidTo> {
return {ToOptionalUser<JidFrom>(node->get_attribute("from")), return {ToOptionalUser<JidFrom>(node->get_attribute("from")),
@ -78,12 +56,6 @@ auto impl::BasicStream<JidFrom, JidTo>::Parse(const xmlpp::Element* node) -> imp
ToOptionalString(node->get_attribute("version")), ToOptionalString(node->get_attribute("version")),
ToOptionalString(node->get_attribute("lang", "xml"))}; 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 UserStream::Parse(const xmlpp::Element* node) -> UserStream;
template auto ServerStream::Parse(const xmlpp::Element* node) -> ServerStream; template auto ServerStream::Parse(const xmlpp::Element* node) -> ServerStream;