1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 23:23:13 +02:00

Rework the interface for service references.

This commit is contained in:
Sadie Powell
2026-01-10 21:23:23 +00:00
parent 25cd6c96e3
commit bfb47ab5a6
14 changed files with 82 additions and 55 deletions
+17 -7
View File
@@ -138,20 +138,30 @@ class ServiceReference
Anope::string name;
public:
ServiceReference() = default;
ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n)
ServiceReference(const Anope::string &t, const Anope::string &n = "")
: type(t)
, name(n)
{
}
const Anope::string &GetServiceName() const { return name; }
/** Retrieves the name of the service (e.g. mysql/main). */
const auto &GetServiceName() const { return name; }
const Anope::string &GetServiceType() const { return type; }
/** Retrieves the type of the service (e.g. SQL::Provider). */
const auto &GetServiceType() const { return type; }
inline void operator=(const Anope::string &n)
/** Invalidates the reference and changes the name of the referenced service. */
void SetServiceName(const Anope::string& newname)
{
this->name = n;
this->invalid = true;
this->name = newname;
}
/** Invalidates the reference and changes the type of the referenced service. */
void SetServiceType(const Anope::string& newtype)
{
this->invalid = true;
this->type = newtype;
}
operator bool() override