Add constexpr to jid setters

This commit is contained in:
sha512sum 2024-09-02 16:16:32 +00:00
parent 3161bf763d
commit 03f4c11266

View file

@ -13,12 +13,12 @@ struct BareJid {
friend auto ToString(const BareJid& jid) -> std::string;
template <typename Self>
[[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid {
[[nodiscard]] constexpr auto Username(this Self&& self, std::string username) -> BareJid {
return utils::FieldSetHelper::With<"username", BareJid>(std::forward<Self>(self), std::move(username));
}
template <typename Self>
[[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid {
[[nodiscard]] constexpr auto Server(this Self&& self, std::string server) -> BareJid {
return utils::FieldSetHelper::With<"server", BareJid>(std::forward<Self>(self), std::move(server));
}
};
@ -30,12 +30,12 @@ struct BareResourceJid {
friend auto ToString(const BareResourceJid& jid) -> std::string;
template <typename Self>
[[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid {
[[nodiscard]] constexpr auto Server(this Self&& self, std::string server) -> BareResourceJid {
return utils::FieldSetHelper::With<"server", BareResourceJid>(std::forward<Self>(self), std::move(server));
}
template <typename Self>
[[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid {
[[nodiscard]] constexpr auto Resource(this Self&& self, std::string resource) -> BareResourceJid {
return utils::FieldSetHelper::With<"resource", BareResourceJid>(std::forward<Self>(self), std::move(resource));
}
};
@ -48,17 +48,17 @@ struct FullJid {
friend auto ToString(const FullJid& jid) -> std::string;
template <typename Self>
[[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid {
[[nodiscard]] constexpr auto Username(this Self&& self, std::string username) -> FullJid {
return utils::FieldSetHelper::With<"username", FullJid>(std::forward<Self>(self), std::move(username));
};
template <typename Self>
[[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid {
[[nodiscard]] constexpr auto Server(this Self&& self, std::string server) -> FullJid {
return utils::FieldSetHelper::With<"server", FullJid>(std::forward<Self>(self), std::move(server));
};
template <typename Self>
[[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid {
[[nodiscard]] constexpr auto Resource(this Self&& self, std::string resource) -> FullJid {
return utils::FieldSetHelper::With<"resource", FullJid>(std::forward<Self>(self), std::move(resource));
};
};