Use more correct setters in streams and jid
This commit is contained in:
parent
5c5d1a37d5
commit
df761748b0
2 changed files with 18 additions and 18 deletions
|
@ -14,12 +14,12 @@ struct BareJid {
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid {
|
[[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid {
|
||||||
return utils::FieldSetHelper::With<"username">(std::forward<Self>(self), std::move(username));
|
return utils::FieldSetHelper::With<"username", BareJid>(std::forward<Self>(self), std::move(username));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid {
|
[[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid {
|
||||||
return utils::FieldSetHelper::With<"server">(std::forward<Self>(self), std::move(server));
|
return utils::FieldSetHelper::With<"server", BareJid>(std::forward<Self>(self), std::move(server));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,12 +31,12 @@ struct BareResourceJid {
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid {
|
[[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid {
|
||||||
return utils::FieldSetHelper::With<"server">(std::forward<Self>(self), std::move(server));
|
return utils::FieldSetHelper::With<"server", BareResourceJid>(std::forward<Self>(self), std::move(server));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid {
|
[[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid {
|
||||||
return utils::FieldSetHelper::With<"resource">(std::forward<Self>(self), std::move(resource));
|
return utils::FieldSetHelper::With<"resource", BareResourceJid>(std::forward<Self>(self), std::move(resource));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,17 +49,17 @@ struct FullJid {
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid {
|
[[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid {
|
||||||
return utils::FieldSetHelper::With<"username">(std::forward<Self>(self), std::move(username));
|
return utils::FieldSetHelper::With<"username", FullJid>(std::forward<Self>(self), std::move(username));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid {
|
[[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid {
|
||||||
return utils::FieldSetHelper::With<"server">(std::forward<Self>(self), std::move(server));
|
return utils::FieldSetHelper::With<"server", FullJid>(std::forward<Self>(self), std::move(server));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid {
|
[[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid {
|
||||||
return utils::FieldSetHelper::With<"resource">(std::forward<Self>(self), std::move(resource));
|
return utils::FieldSetHelper::With<"resource", FullJid>(std::forward<Self>(self), std::move(resource));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,32 +19,32 @@ struct BasicStream {
|
||||||
std::optional<std::string> xmlLang;
|
std::optional<std::string> xmlLang;
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto From(this Self&& self, FromType value) {
|
constexpr auto From(this Self&& self, FromType value) -> BasicStream {
|
||||||
return utils::FieldSetHelper::With<"from">(std::forward<Self>(self), std::move(value));
|
return utils::FieldSetHelper::With<"from", BasicStream>(std::forward<Self>(self), std::move(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto To(this Self&& self, ToType value) {
|
constexpr auto To(this Self&& self, ToType value) -> BasicStream {
|
||||||
return utils::FieldSetHelper::With<"to">(std::forward<Self>(self), std::move(value));
|
return utils::FieldSetHelper::With<"to", BasicStream>(std::forward<Self>(self), std::move(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto Id(this Self&& self, std::optional<std::string> value) {
|
constexpr auto Id(this Self&& self, std::optional<std::string> value) -> BasicStream {
|
||||||
return utils::FieldSetHelper::With<"id">(std::forward<Self>(self), std::move(value));
|
return utils::FieldSetHelper::With<"id", BasicStream>(std::forward<Self>(self), std::move(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto Version(this Self&& self, std::optional<std::string> value) {
|
constexpr auto Version(this Self&& self, std::optional<std::string> value) -> BasicStream {
|
||||||
return utils::FieldSetHelper::With<"version">(std::forward<Self>(self), std::move(value));
|
return utils::FieldSetHelper::With<"version", BasicStream>(std::forward<Self>(self), std::move(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto XmlLang(this Self&& self, std::optional<std::string> value) {
|
constexpr auto XmlLang(this Self&& self, std::optional<std::string> value) -> BasicStream {
|
||||||
return utils::FieldSetHelper::With<"xmlLang">(std::forward_like<Self>(self), std::move(value));
|
return utils::FieldSetHelper::With<"xmlLang", BasicStream>(std::forward_like<Self>(self), std::move(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
auto SerializeStream(pugi::xml_node& node) const -> void;
|
auto SerializeStream(pugi::xml_node& node) const -> void;
|
||||||
friend auto operator<<(pugi::xml_node& node, const BasicStream<JidFrom, JidTo>& stream) -> pugi::xml_node& {
|
friend auto operator<<(pugi::xml_node& node, const BasicStream& stream) -> pugi::xml_node& {
|
||||||
return (stream.SerializeStream(node), node);
|
return (stream.SerializeStream(node), node);
|
||||||
};
|
};
|
||||||
static auto Parse(const pugi::xml_node& node) -> BasicStream<JidFrom, JidTo>;
|
static auto Parse(const pugi::xml_node& node) -> BasicStream<JidFrom, JidTo>;
|
||||||
|
|
Loading…
Reference in a new issue