1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/extensions/sqlite/extension.h Sun Jul 29 01:15:31 2007 +0000
1.3 @@ -0,0 +1,113 @@
1.4 +/**
1.5 + * vim: set ts=4 :
1.6 + * ===============================================================
1.7 + * SourceMod SQLite Driver Extension
1.8 + * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
1.9 + * ===============================================================
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or
1.12 + * modify it under the terms of the GNU General Public License
1.13 + * as published by the Free Software Foundation; either version 2
1.14 + * of the License, or (at your option) any later version.
1.15 + * This program is distributed in the hope that it will be useful,
1.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.18 + * GNU General Public License for more details.
1.19 + *
1.20 + * You should have received a copy of the GNU General Public License
1.21 + * along with this program; if not, write to the Free Software
1.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1.23 + *
1.24 + * Version: $Id$
1.25 + */
1.26 +
1.27 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
1.28 +#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
1.29 +
1.30 +/**
1.31 + * @file extension.h
1.32 + * @brief Sample extension code header.
1.33 + */
1.34 +
1.35 +#include "smsdk_ext.h"
1.36 +
1.37 +
1.38 +/**
1.39 + * @brief Sample implementation of the SDK Extension.
1.40 + * Note: Uncomment one of the pre-defined virtual functions in order to use it.
1.41 + */
1.42 +class SqliteExt : public SDKExtension
1.43 +{
1.44 +public:
1.45 + /**
1.46 + * @brief This is called after the initial loading sequence has been processed.
1.47 + *
1.48 + * @param error Error message buffer.
1.49 + * @param maxlength Size of error message buffer.
1.50 + * @param late Whether or not the module was loaded after map load.
1.51 + * @return True to succeed loading, false to fail.
1.52 + */
1.53 + virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
1.54 +
1.55 + /**
1.56 + * @brief This is called right before the extension is unloaded.
1.57 + */
1.58 + virtual void SDK_OnUnload();
1.59 +
1.60 + /**
1.61 + * @brief This is called once all known extensions have been loaded.
1.62 + * Note: It is is a good idea to add natives here, if any are provided.
1.63 + */
1.64 + //virtual void SDK_OnAllLoaded();
1.65 +
1.66 + /**
1.67 + * @brief Called when the pause state is changed.
1.68 + */
1.69 + //virtual void SDK_OnPauseChange(bool paused);
1.70 +
1.71 + /**
1.72 + * @brief this is called when Core wants to know if your extension is working.
1.73 + *
1.74 + * @param error Error message buffer.
1.75 + * @param maxlength Size of error message buffer.
1.76 + * @return True if working, false otherwise.
1.77 + */
1.78 + //virtual bool QueryRunning(char *error, size_t maxlength);
1.79 +public:
1.80 +#if defined SMEXT_CONF_METAMOD
1.81 + /**
1.82 + * @brief Called when Metamod is attached, before the extension version is called.
1.83 + *
1.84 + * @param error Error buffer.
1.85 + * @param maxlength Maximum size of error buffer.
1.86 + * @param late Whether or not Metamod considers this a late load.
1.87 + * @return True to succeed, false to fail.
1.88 + */
1.89 + //virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
1.90 +
1.91 + /**
1.92 + * @brief Called when Metamod is detaching, after the extension version is called.
1.93 + * NOTE: By default this is blocked unless sent from SourceMod.
1.94 + *
1.95 + * @param error Error buffer.
1.96 + * @param maxlength Maximum size of error buffer.
1.97 + * @return True to succeed, false to fail.
1.98 + */
1.99 + //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
1.100 +
1.101 + /**
1.102 + * @brief Called when Metamod's pause state is changing.
1.103 + * NOTE: By default this is blocked unless sent from SourceMod.
1.104 + *
1.105 + * @param paused Pause state being set.
1.106 + * @param error Error buffer.
1.107 + * @param maxlength Maximum size of error buffer.
1.108 + * @return True to succeed, false to fail.
1.109 + */
1.110 + //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
1.111 +#endif
1.112 +};
1.113 +
1.114 +size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...);
1.115 +
1.116 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_