extensions/regex/extension.h
author Scott Ehlert <ds@alliedmods.net>
Fri Apr 11 17:16:36 2008 +0000 (2008-04-11)
changeset 1990 de135d1f05b1
parent 1952 b7aa2b626807
child 2289 44045ead61cd
permissions -rw-r--r--
Added more missing svn:keywords properties to some files (this should be the last of them before I never have to do this again)
Moved sm_memtable files in sqlite extension to sdk directory (to be consistent with topmenus)
Some extension source files had an incorrect extension name in their headers
ds@1952
     1
/**
ds@1952
     2
 * vim: set ts=4 :
ds@1952
     3
 * =============================================================================
ds@1990
     4
 * SourceMod Regular Expressions Extension
ds@1952
     5
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
ds@1952
     6
 * =============================================================================
ds@1952
     7
 *
ds@1952
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1952
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1952
    10
 * Free Software Foundation.
ds@1952
    11
 * 
ds@1952
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1952
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1952
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1952
    15
 * details.
ds@1952
    16
 *
ds@1952
    17
 * You should have received a copy of the GNU General Public License along with
ds@1952
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
ds@1952
    19
 *
ds@1952
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1952
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1952
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1952
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1952
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1952
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1952
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1952
    27
 * or <http://www.sourcemod.net/license.php>.
ds@1952
    28
 *
ds@1952
    29
 * Version: $Id$
ds@1952
    30
 */
ds@1952
    31
ds@1952
    32
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
ds@1952
    33
#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
ds@1952
    34
ds@1952
    35
/**
ds@1952
    36
 * @file extension.h
ds@1990
    37
 * @brief Regex extension code header.
ds@1952
    38
 */
ds@1952
    39
ds@1952
    40
#include "smsdk_ext.h"
ds@1952
    41
ds@1952
    42
ds@1952
    43
/**
ds@1952
    44
 * @brief Sample implementation of the SDK Extension.
ds@1952
    45
 * Note: Uncomment one of the pre-defined virtual functions in order to use it.
ds@1952
    46
 */
ds@1952
    47
class RegexExtension : public SDKExtension
ds@1952
    48
{
ds@1952
    49
public:
ds@1952
    50
	/**
ds@1952
    51
	 * @brief This is called after the initial loading sequence has been processed.
ds@1952
    52
	 *
ds@1952
    53
	 * @param error		Error message buffer.
ds@1952
    54
	 * @param maxlength	Size of error message buffer.
ds@1952
    55
	 * @param late		Whether or not the module was loaded after map load.
ds@1952
    56
	 * @return			True to succeed loading, false to fail.
ds@1952
    57
	 */
ds@1952
    58
	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
ds@1952
    59
	
ds@1952
    60
	/**
ds@1952
    61
	 * @brief This is called right before the extension is unloaded.
ds@1952
    62
	 */
ds@1952
    63
	virtual void SDK_OnUnload();
ds@1952
    64
ds@1952
    65
	/**
ds@1952
    66
	 * @brief This is called once all known extensions have been loaded.
ds@1952
    67
	 * Note: It is is a good idea to add natives here, if any are provided.
ds@1952
    68
	 */
ds@1952
    69
	//virtual void SDK_OnAllLoaded();
ds@1952
    70
ds@1952
    71
	/**
ds@1952
    72
	 * @brief Called when the pause state is changed.
ds@1952
    73
	 */
ds@1952
    74
	//virtual void SDK_OnPauseChange(bool paused);
ds@1952
    75
ds@1952
    76
	/**
ds@1952
    77
	 * @brief this is called when Core wants to know if your extension is working.
ds@1952
    78
	 *
ds@1952
    79
	 * @param error		Error message buffer.
ds@1952
    80
	 * @param maxlength	Size of error message buffer.
ds@1952
    81
	 * @return			True if working, false otherwise.
ds@1952
    82
	 */
ds@1952
    83
	//virtual bool QueryRunning(char *error, size_t maxlength);
ds@1952
    84
public:
ds@1952
    85
#if defined SMEXT_CONF_METAMOD
ds@1952
    86
	/**
ds@1952
    87
	 * @brief Called when Metamod is attached, before the extension version is called.
ds@1952
    88
	 *
ds@1952
    89
	 * @param error			Error buffer.
ds@1952
    90
	 * @param maxlength		Maximum size of error buffer.
ds@1952
    91
	 * @param late			Whether or not Metamod considers this a late load.
ds@1952
    92
	 * @return				True to succeed, false to fail.
ds@1952
    93
	 */
ds@1952
    94
	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
ds@1952
    95
ds@1952
    96
	/**
ds@1952
    97
	 * @brief Called when Metamod is detaching, after the extension version is called.
ds@1952
    98
	 * NOTE: By default this is blocked unless sent from SourceMod.
ds@1952
    99
	 *
ds@1952
   100
	 * @param error			Error buffer.
ds@1952
   101
	 * @param maxlength		Maximum size of error buffer.
ds@1952
   102
	 * @return				True to succeed, false to fail.
ds@1952
   103
	 */
ds@1952
   104
	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
ds@1952
   105
ds@1952
   106
	/**
ds@1952
   107
	 * @brief Called when Metamod's pause state is changing.
ds@1952
   108
	 * NOTE: By default this is blocked unless sent from SourceMod.
ds@1952
   109
	 *
ds@1952
   110
	 * @param paused		Pause state being set.
ds@1952
   111
	 * @param error			Error buffer.
ds@1952
   112
	 * @param maxlength		Maximum size of error buffer.
ds@1952
   113
	 * @return				True to succeed, false to fail.
ds@1952
   114
	 */
ds@1952
   115
	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
ds@1952
   116
#endif
ds@1952
   117
};
ds@1952
   118
ds@1952
   119
ds@1952
   120
class RegexHandler: public IHandleTypeDispatch
ds@1952
   121
{
ds@1952
   122
public:
ds@1952
   123
	void OnHandleDestroy(HandleType_t type, void *object);
ds@1952
   124
};
ds@1952
   125
ds@1952
   126
extern RegexHandler g_RegexHandler;
ds@1952
   127
extern HandleType_t g_RegexHandle;
ds@1952
   128
ds@1952
   129
ds@1952
   130
// Natives
ds@1952
   131
extern const sp_nativeinfo_t regex_natives[];
ds@1952
   132
ds@1952
   133
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_