2 * ===============================================================
3 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
4 * ===============================================================
6 * This file is not open source and may not be copied without explicit
7 * written permission of AlliedModders LLC. This file may not be redistributed
8 * in whole or significant part.
9 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
14 #ifndef _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
15 #define _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
20 BaseMemTable(unsigned int init_size);
24 * Allocates 'size' bytes of memory.
25 * Optionally outputs the address through 'addr'.
26 * Returns an index >= 0 on success, < 0 on failure.
28 int CreateMem(unsigned int size, void **addr);
31 * Given an index into the memory table, returns its address.
32 * Returns NULL if invalid.
34 void *GetAddress(int index);
37 * Scraps the memory table. For caching purposes, the memory
38 * is not freed, however subsequent calls to CreateMem() will
39 * begin at the first index again.
45 unsigned char *membase;
53 BaseStringTable(unsigned int init_size);
57 * Adds a string to the string table and returns its index.
59 int AddString(const char *string);
62 * Given an index into the string table, returns the associated string.
64 inline const char *GetString(int str)
66 return (const char *)m_table.GetAddress(str);
70 * Scraps the string table. For caching purposes, the memory
71 * is not freed, however subsequent calls to AddString() will
72 * begin at the first index again.
77 * Returns the parent BaseMemTable that this string table uses.
79 inline BaseMemTable *GetMemTable()
87 #endif //_INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_