extensions/structs/Struct.h
author Nicholas Hastings <skamonkey@gmail.com>
Wed Apr 03 12:25:54 2013 -0400 (2013-04-03)
changeset 3883 ee82b6ecc09d
parent 2224 676c3b826f13
permissions -rw-r--r--
Fixed AllPluginsLoaded activities happening before SM is loaded (r=dvander`hom).
     1 /**
     2 * vim: set ts=4 :
     3 * =============================================================================
     4 * SourceMod Sample Extension
     5 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     6 * =============================================================================
     7 *
     8 * This program is free software; you can redistribute it and/or modify it under
     9 * the terms of the GNU General Public License, version 3.0, as published by the
    10 * Free Software Foundation.
    11 * 
    12 * This program is distributed in the hope that it will be useful, but WITHOUT
    13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    15 * details.
    16 *
    17 * You should have received a copy of the GNU General Public License along with
    18 * this program.  If not, see <http://www.gnu.org/licenses/>.
    19 *
    20 * As a special exception, AlliedModders LLC gives you permission to link the
    21 * code of this program (as well as its derivative works) to "Half-Life 2," the
    22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    23 * by the Valve Corporation.  You must obey the GNU General Public License in
    24 * all respects for all other code used.  Additionally, AlliedModders LLC grants
    25 * this exception to all derivative works.  AlliedModders LLC defines further
    26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    27 * or <http://www.sourcemod.net/license.php>.
    28 *
    29 * Version: $Id$
    30 */
    31 
    32 #ifndef _INCLUDE_SOURCEMOD_STRUCT_H_
    33 #define _INCLUDE_SOURCEMOD_STRUCT_H_
    34 
    35 #include "sm_trie_tpl.h"
    36 #include "sh_list.h"
    37 
    38 enum MemberType
    39 {
    40 	Member_Unknown,
    41 	Member_Int8,
    42 	Member_Int8Pointer,
    43 	Member_Int16,
    44 	Member_Int16Pointer,
    45 	Member_Int32,
    46 	Member_Int32Pointer,
    47 	Member_Float,
    48 	Member_FloatPointer,
    49 	//Member_Struct,
    50 	//Member_StructPointer,
    51 	Member_Char,
    52 	Member_CharPointer,
    53 	Member_Vector,
    54 	Member_VectorPointer,
    55 	Member_EHandle,
    56 	Member_EHandlePointer,
    57 };
    58 
    59 struct MemberInfo
    60 {
    61 	MemberInfo();
    62 
    63 	char name[100];
    64 	MemberType type;
    65 	int size;
    66 	int offset;
    67 };
    68 
    69 struct StructInfo
    70 {
    71 	StructInfo();
    72 	~StructInfo();
    73 	void AddMember(const char *name, MemberInfo *member);
    74 
    75 	char name[100];
    76 	int size;
    77 	KTrie<MemberInfo *> members;
    78 	SourceHook::List<MemberInfo *> membersList;
    79 
    80 	bool getOffset(const char *member, int *offset);
    81 	bool getType(const char *member, MemberType*type);
    82 	bool getSize(const char *member, int *size);
    83 };
    84 
    85 #endif //_INCLUDE_SOURCEMOD_STRUCT_H_