3 * ======================================================
5 * Copyright (C) 2004-2007 AlliedModders LLC and authors.
7 * ======================================================
9 * This software is provided 'as-is', without any express or implied warranty.
10 * In no event will the authors be held liable for any damages arising from
11 * the use of this software.
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software in a
19 * product, an acknowledgment in the product documentation would be
20 * appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must not be
22 * misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
28 #ifndef _INCLUDE_METAMOD_IPLUGINMANAGER_H
29 #define _INCLUDE_METAMOD_IPLUGINMANAGER_H
32 * @brief Plugin Manager interface
33 * @file IPluginManager.h
36 #include <ISmmPluginExt.h>
52 * @brief Status of a plugin at runtime
63 class ISmmPluginManager
67 * @brief Loads a plugin and returns its id. If this is called before DLLInit(),
68 * then the plugin is considered to be "hot" - it might refuse its own load later!
69 * Also, a hot plugin might not have an error message.
71 * @param file String containing file name
72 * @param source Specifies who loaded the plugin
73 * @param status Status of the plugin
74 * @param ismm Pointer to Smm API
75 * @param error String buffer for error messages
76 * @param maxlen Maximum length of buffer
77 * @return Id of plugin
79 virtual PluginId Load(const char *file, PluginId source, bool &already, char *error, size_t maxlen) =0;
82 * @brief Unloads a plugin
84 * @param id Id of plugin
85 * @param error String buffer for error messages
86 * @param maxlen Maximum length of buffer
87 * @return True on success, false otherwise
89 virtual bool Unload(PluginId id, bool force, char *error, size_t maxlen) =0;
92 * @brief Pauses a plugin
94 * @param id Id of plugin
95 * @param error String buffer for error messages
96 * @param maxlen Maximum length of buffer
97 * @return True on success, false otherwise
99 virtual bool Pause(PluginId id, char *error, size_t maxlen) =0;
102 * @brief Unpauses a plugin
104 * @param id Id of plugin
105 * @param force If true, forces the plugin to unload
106 * @param error String buffer for error messages
107 * @param maxlen Maximum length of buffer
108 * @return True on success, false otherwise
110 virtual bool Unpause(PluginId id, char *error, size_t maxlen) =0;
113 * @brief Unloads all plugins forcefully
115 * @return True on success, false otherwise
117 virtual bool UnloadAll() =0;
120 * @brief Returns information about a plugin
122 * @param id Id of plugin
123 * @param file Pointer to store filename pointer, or NULL to ignore.
124 * @param status Pointer to store status, or NULL to ignore.
125 * @param source Pointer to store source, or NULL to ignore.
126 * @return True on success, false if not found
128 virtual bool Query(PluginId id, const char **file, Pl_Status *status, PluginId *source) =0;
131 * @brief Checks another plugin's QueryRunning() status.
133 * @param id Id of plugin
134 * @param error Message buffer
135 * @param maxlen Size of error buffer
136 * @return Status value
138 virtual bool QueryRunning(PluginId id, char *error, size_t maxlength) =0;
141 * @brief Returns the handle of a plugin (OS dependent meaning)
143 * @param id Id of plugin
144 * @param handle Pointer to store handle pointer, or NULL to ignore.
145 * @return True if plugin id is valid, false otherwise
147 virtual bool QueryHandle(PluginId id, void **handle) =0;
151 #if !defined METAMOD_NO_AUTO_NAMESPACE
152 using namespace SourceMM;
155 #endif //_INCLUDE_PLUGINMANAGER_H