larra/library/src/roster.cpp

31 lines
1,020 B
C++
Raw Normal View History

2024-11-25 13:20:32 +00:00
#include <larra/roster.hpp>
#include <larra/serialization/auto.hpp>
namespace larra::xmpp::serialization {
namespace iq = larra::xmpp::iq;
template <>
constexpr auto kSerializationConfig<iq::RosterItem> = SerializationConfig<iq::RosterItem>{};
template <>
constexpr auto kSerializationConfig<iq::Roster> = SerializationConfig<iq::Roster>{}.With<"items">({Config<std::vector<iq::RosterItem>>{}});
} // namespace larra::xmpp::serialization
namespace larra::xmpp::iq {
namespace S = larra::xmpp::serialization;
auto operator<<(xmlpp::Element* element, const RosterItem& self) -> void {
S::Serialize(element, self);
}
auto RosterItem::Parse(xmlpp::Element* element) -> RosterItem {
return S::Parse<RosterItem>(element);
}
auto operator<<(xmlpp::Element* element, const Roster& self) -> void {
element->set_attribute("xmlns", Roster::kDefaultNamespace);
S::Serialize(element, self);
}
auto Roster::Parse(xmlpp::Element* element) -> Roster {
return S::Parse<Roster>(element);
}
} // namespace larra::xmpp::iq