More consistency of some sort...
Oh god, what has possessed me to do this?
3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is part of the SourceMod/SourcePawn SDK. This file may only be
8 * used or modified under the Terms and Conditions of its License Agreement,
9 * which is found in public/licenses/LICENSE.txt. As of this notice, derivative
10 * works must be licensed under the GNU General Public License (version 2 or
11 * greater). A copy of the GPL is included under public/licenses/GPL.txt.
13 * To view the latest information, see: http://www.sourcemod.net/license.php
18 #ifndef _INCLUDE_SOURCEMOD_MAIN_HELPER_INTERFACE_H_
19 #define _INCLUDE_SOURCEMOD_MAIN_HELPER_INTERFACE_H_
23 * @brief Defines miscellanious helper functions useful to extensions.
26 #include <IShareSys.h>
27 #include <sp_vm_api.h>
28 #include <IDataPack.h>
30 #define SMINTERFACE_SOURCEMOD_NAME "ISourceMod"
31 #define SMINTERFACE_SOURCEMOD_VERSION 1
36 * @brief Describes various ways of formatting a base path.
40 Path_None = 0, /**< No base path */
41 Path_Game, /**< Base path is absolute mod folder */
42 Path_SM, /**< Base path is absolute to SourceMod */
43 Path_SM_Rel, /**< Base path is relative to SourceMod */
47 * @brief Contains miscellaneous helper functions.
49 class ISourceMod : public SMInterface
52 virtual const char *GetInterfaceName()
54 return SMINTERFACE_SOURCEMOD_NAME;
56 virtual unsigned int GetInterfaceVersion()
58 return SMINTERFACE_SOURCEMOD_VERSION;
62 * @brief Returns the full path to the mod directory.
64 * @return A string containing the full mod path.
66 virtual const char *GetModPath() const =0;
69 * @brief Returns the full path to the SourceMod directory.
71 * @return A string containing the full SourceMod path.
73 virtual const char *GetSourceModPath() const =0;
76 * @brief Builds a platform path for a specific target base path.
78 * @param type Type of path to use as a base.
79 * @param buffer Buffer to write to.
80 * @param maxlength Size of buffer.
81 * @param format Format string.
82 * @param ... Format arguments.
83 * @return Number of bytes written.
85 virtual size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...) =0;
88 * @brief Logs a message to the SourceMod logs.
90 * @param pExt Extension calling this function.
91 * @param format Message format.
92 * @param ... Message format parameters.
94 virtual void LogMessage(IExtension *pExt, const char *format, ...) =0;
97 * @brief Logs a message to the SourceMod error logs.
99 * @param pExt Extension calling this function.
100 * @param format Message format.
101 * @param ... Message format parameters.
103 virtual void LogError(IExtension *pExt, const char *format, ...) =0;
106 * @brief Formats a string from a native.
108 * @param buffer Buffer to store message.
109 * @param maxlength Maximum length of buffer (inculding null terminator).
110 * @param pContext Pointer to the plugin's context.
111 * @param params Parameter array that was passed to the native.
112 * @param param Parameter index where format string and variable arguments begin.
113 * Note: parameter indexes start at 1.
114 * @return Number of bytes written, not including the null terminator.
116 virtual size_t FormatString(char *buffer,
118 SourcePawn::IPluginContext *pContext,
119 const cell_t *params,
120 unsigned int param) =0;
123 * @brief Creates a data pack object.
125 * @return A new IDataPack object.
127 virtual IDataPack *CreateDataPack() =0;
130 * @brief Releases a data pack's resources so it can be re-used.
132 * @param pack An IDataPack object to release.
134 virtual void FreeDataPack(IDataPack *pack) =0;
137 * @brief Returns the automated data pack handle type.
139 * The readonly data type is the parent of the writable type.
140 * Note that calling CloseHandle() on either type will release the data pack.
141 * The readonly type is inheritable, but due to limitations of the Handle System,
142 * the writable type is not.
144 * @param readonly If true, the readonly type will be returned.
145 * @return The Handle type for storing generic data packs.
147 virtual HandleType_t GetDataPackHandleType(bool readonly=false) =0;
151 #endif //_INCLUDE_SOURCEMOD_MAIN_HELPER_INTERFACE_H_