diff --git a/CMakeLists.txt b/CMakeLists.txt index bd3315d..9c4cf7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,13 +176,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 - OpenSSL::SSL nameof::nameof + 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 - nameof::nameof + nameof::nameof fmt::fmt OpenSSL::Crypto spdlog xmlplusplus ${LIBXML2_LIBRARIES}) endif() diff --git a/library/include/larra/impl/public_cast.hpp b/library/include/larra/impl/public_cast.hpp deleted file mode 100644 index 1f39ae5..0000000 --- a/library/include/larra/impl/public_cast.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once -#include -#include - -namespace larra::xmpp::impl { - -template -struct PublicCastTag { - friend constexpr auto MagicGetPrivateMember(PublicCastTag); -}; - -template -struct PublicCast {}; - -template -struct PublicCast { - friend constexpr auto MagicGetPrivateMember(PublicCastTag) { - return ptr; - } -}; - -template -struct PublicCast { - friend constexpr auto MagicGetPrivateMember(PublicCastTag) { - return ptr; - } -}; - -template -constexpr auto GetPrivateMember(const T&) { - return MagicGetPrivateMember(PublicCastTag, I>{}); -}; - -} // namespace larra::xmpp::impl diff --git a/library/src/xml_stream.cpp b/library/src/xml_stream.cpp index 522f2a8..fbd9aa6 100644 --- a/library/src/xml_stream.cpp +++ b/library/src/xml_stream.cpp @@ -1,20 +1,23 @@ #include -#include #include #include #include -#include +#include -namespace larra::xmpp::impl { +namespace utempl { template struct PublicCast<&xmlpp::SaxParser::sax_handler_>; +} + +namespace larra::xmpp::impl { + auto Parser::ParseChunk(std::string_view str) -> const xmlError* { xmlResetLastError(); if(!context_) { - this->context_ = xmlCreatePushParserCtxt((this->*GetPrivateMember(static_cast(*this))).get(), + this->context_ = xmlCreatePushParserCtxt((this->*utempl::GetPrivateMember<"sax_handler_">(static_cast(*this))).get(), nullptr, // user_data nullptr, // chunk 0, // size