diff options
| author | Adam <Adam@anope.org> | 2011-08-25 16:21:21 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-09-10 01:58:38 -0400 |
| commit | f025d1b495cee3aadb6b7b45652d1cab3b7b7b6d (patch) | |
| tree | 02df5a3f12104996af87d1b6c5ec9db9d45b6bde /include/modules.h | |
| parent | 8c4417cad180f3c5448c5b7509b1bf2235e3077e (diff) | |
Made service_reference type safe
Diffstat (limited to 'include/modules.h')
| -rw-r--r-- | include/modules.h | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/include/modules.h b/include/modules.h index 5ba1be938..a34b7f64d 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1076,16 +1076,10 @@ enum Implementation I_END }; -class Service; - /** Used to manage modules. */ class CoreExport ModuleManager { - private: - /** A map of service providers - */ - static std::map<Anope::string, Service *> ServiceProviders; public: /** Event handler hooks. * This needs to be public to be used by FOREACH_MOD and friends. @@ -1197,29 +1191,6 @@ class CoreExport ModuleManager */ static void UnloadAll(); - /** Register a service - * @param s The service - * @return true if it was successfully registeed, else false (service name colision) - */ - static bool RegisterService(Service *s); - - /** Unregister a service - * @param s The service - * @return true if it was unregistered successfully - */ - static bool UnregisterService(Service *s); - - /** Get a service - * @param name The service name - * @return The services, or NULL - */ - static Service *GetService(const Anope::string &name); - - /** Get the existing service key names - * @return The keys - */ - static std::vector<Anope::string> GetServiceKeys(); - private: /** Call the module_delete function to safely delete the module * @param m the module to delete @@ -1254,7 +1225,7 @@ class service_reference : public dynamic_reference<T> Anope::string name; public: - service_reference(const Anope::string &n) : dynamic_reference<T>(static_cast<T *>(ModuleManager::GetService(n))), name(n) + service_reference(const Anope::string &n) : dynamic_reference<T>(NULL), name(n) { } @@ -1267,7 +1238,7 @@ class service_reference : public dynamic_reference<T> } if (!this->ref) { - this->ref = static_cast<T *>(ModuleManager::GetService(this->name)); + this->ref = Service<T>::FindService(this->name); if (this->ref) this->ref->AddReference(this); } |
