Remove pugixml dependency
This commit is contained in:
parent
7b97541320
commit
f4cb788a48
4 changed files with 3 additions and 37 deletions
|
@ -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()
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <larra/utils.hpp>
|
||||
#include <optional>
|
||||
#include <pugixml.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace larra::xmpp {
|
||||
|
@ -51,10 +50,9 @@ struct StreamFeatures {
|
|||
return utils::FieldSetHelper::With<"saslMechanisms">(std::forward<Self>(self), std::move(value));
|
||||
}
|
||||
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));
|
||||
}
|
||||
[[nodiscard]] static auto Parse(pugi::xml_node) -> StreamFeatures;
|
||||
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> StreamFeatures;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <libxml++/libxml++.h>
|
||||
|
||||
#include <larra/jid.hpp>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
namespace larra::xmpp {
|
||||
|
||||
|
@ -58,7 +57,6 @@ struct BasicStream {
|
|||
return node;
|
||||
}
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,23 +3,10 @@
|
|||
|
||||
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> {
|
||||
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>
|
||||
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 <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>
|
||||
auto impl::BasicStream<JidFrom, JidTo>::Parse(const xmlpp::Element* node) -> impl::BasicStream<JidFrom, JidTo> {
|
||||
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("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;
|
||||
|
|
Loading…
Reference in a new issue