sourcemm/IPluginManager.h
branchsourcemm-1.6.0
changeset 428 40a9d2f61121
parent 370 4dc28ab1c722
child 429 cadecde4b802
     1.1 --- a/sourcemm/IPluginManager.h	Thu Oct 04 19:46:28 2007 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,154 +0,0 @@
     1.4 -/**
     1.5 - * vim: set ts=4 :
     1.6 - * ======================================================
     1.7 - * Metamod:Source
     1.8 - * Copyright (C) 2004-2007 AlliedModders LLC and authors.
     1.9 - * All rights reserved.
    1.10 - * ======================================================
    1.11 - *
    1.12 - * This software is provided 'as-is', without any express or implied warranty.
    1.13 - * In no event will the authors be held liable for any damages arising from 
    1.14 - * the use of this software.
    1.15 - * 
    1.16 - * Permission is granted to anyone to use this software for any purpose, 
    1.17 - * including commercial applications, and to alter it and redistribute it 
    1.18 - * freely, subject to the following restrictions:
    1.19 - *
    1.20 - * 1. The origin of this software must not be misrepresented; you must not 
    1.21 - * claim that you wrote the original software. If you use this software in a 
    1.22 - * product, an acknowledgment in the product documentation would be 
    1.23 - * appreciated but is not required.
    1.24 - * 2. Altered source versions must be plainly marked as such, and must not be
    1.25 - * misrepresented as being the original software.
    1.26 - * 3. This notice may not be removed or altered from any source distribution.
    1.27 - *
    1.28 - * Version: $Id$
    1.29 - */
    1.30 -
    1.31 -#ifndef _INCLUDE_PLUGINMANAGER_H
    1.32 -#define _INCLUDE_PLUGINMANAGER_H
    1.33 -
    1.34 -/**
    1.35 - * @brief Plugin Manager interface
    1.36 - * @file IPluginManager.h
    1.37 - */
    1.38 -
    1.39 -typedef int PluginId;
    1.40 -
    1.41 -#include "ISmmPlugin.h"
    1.42 -
    1.43 -/**
    1.44 - * @brief Load sources
    1.45 - */
    1.46 -enum
    1.47 -{
    1.48 -	Pl_BadLoad=0,
    1.49 -	Pl_Console=-1,
    1.50 -	Pl_File=-2,
    1.51 -	Pl_MinId=1,
    1.52 -};
    1.53 -
    1.54 -/**
    1.55 - * @brief Status of a plugin at runtime
    1.56 - */
    1.57 -enum Pl_Status
    1.58 -{
    1.59 -	Pl_NotFound=-4,
    1.60 -	Pl_Error=-3,
    1.61 -	Pl_Refused=-2,
    1.62 -	Pl_Paused=-1,
    1.63 -	Pl_Running=0,
    1.64 -};
    1.65 -
    1.66 -typedef int PluginId;
    1.67 -struct factories;
    1.68 -
    1.69 -class ISmmPluginManager
    1.70 -{
    1.71 -public:
    1.72 -	/**
    1.73 -	 * @brief Loads a plugin and returns its id.  If this is called before DLLInit(),
    1.74 -	 *  then the plugin is considered to be "hot" - it might refuse its own load later!
    1.75 -	 *  Also, a hot plugin might not have an error message.
    1.76 -	 *
    1.77 -	 * @param file String containing file name
    1.78 -	 * @param source Specifies who loaded the plugin
    1.79 -	 * @param status Status of the plugin 
    1.80 -	 * @param ismm Pointer to Smm API
    1.81 -	 * @param error String buffer for error messages
    1.82 -	 * @param maxlen Maximum length of buffer
    1.83 -	 * @return Id of plugin
    1.84 -	 */
    1.85 -	virtual PluginId Load(const char *file, PluginId source, bool &already, char *error, size_t maxlen) =0;
    1.86 -
    1.87 -	/**
    1.88 -	 * @brief Unloads a plugin
    1.89 -	 *
    1.90 -	 * @param id Id of plugin
    1.91 -	 * @param error String buffer for error messages
    1.92 -	 * @param maxlen Maximum length of buffer
    1.93 -	 * @return True on success, false otherwise
    1.94 -	 */
    1.95 -	virtual bool Unload(PluginId id, bool force, char *error, size_t maxlen) =0;
    1.96 -
    1.97 -	/**
    1.98 -	 * @brief Pauses a plugin
    1.99 -	 *
   1.100 -	 * @param id Id of plugin
   1.101 -	 * @param error String buffer for error messages
   1.102 -	 * @param maxlen Maximum length of buffer
   1.103 -	 * @return True on success, false otherwise
   1.104 -	 */
   1.105 -	virtual bool Pause(PluginId id, char *error, size_t maxlen) =0;
   1.106 -
   1.107 -	/**
   1.108 -	 * @brief Unpauses a plugin
   1.109 -	 *
   1.110 -	 * @param id Id of plugin
   1.111 -	 * @param force If true, forces the plugin to unload
   1.112 -	 * @param error String buffer for error messages
   1.113 -	 * @param maxlen Maximum length of buffer
   1.114 -	 * @return True on success, false otherwise
   1.115 -	 */
   1.116 -	virtual bool Unpause(PluginId id, char *error, size_t maxlen) =0;
   1.117 -
   1.118 -	/**
   1.119 -	 * @brief Unloads all plugins forcefully
   1.120 -	 * 
   1.121 -	 * @return True on success, false otherwise
   1.122 -	 */
   1.123 -	virtual bool UnloadAll() =0;
   1.124 -
   1.125 -	/**
   1.126 -	 * @brief Returns information about a plugin
   1.127 -	 *
   1.128 -	 * @param id Id of plugin
   1.129 -	 * @param file Pointer to file string by reference
   1.130 -	 * @param list Pointer to factories by reference
   1.131 -	 * @param status By reference status of plugin
   1.132 -	 * @param source By reference source of plugin
   1.133 -	 * @return True on success, false if not found
   1.134 -	 */
   1.135 -	virtual bool Query(PluginId id, const char *&file, Pl_Status &status, PluginId &source) =0;
   1.136 -
   1.137 -	/** 
   1.138 -	 * @brief Checks another plugin's QueryRunning() status.
   1.139 -	 *
   1.140 -	 * @param id		Id of plugin
   1.141 -	 * @param error		Message buffer
   1.142 -	 * @param maxlen	Size of error buffer
   1.143 -	 * @return			Status value
   1.144 -	 */
   1.145 -	virtual bool QueryRunning(PluginId id, char *error, size_t maxlength) =0;
   1.146 -
   1.147 -	/**
   1.148 -	 * @brief Returns the handle of a plugin (OS dependent meaning)
   1.149 -	 * 
   1.150 -	 * @param id		Id of plugin
   1.151 -	 * @param handle	By reference handle of plugin, if any
   1.152 -	 * @return			True if plugin id is valid, false otherwise
   1.153 -	 */
   1.154 -	virtual bool QueryHandle(PluginId id, void *&handle) =0;
   1.155 -};
   1.156 -
   1.157 -#endif //_INCLUDE_PLUGINMANAGER_H