2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 /// \brief Entity Class definition loader API.
26 #if !defined( INCLUDED_IECLASS_H )
27 #define INCLUDED_IECLASS_H
29 #include "generic/constant.h"
35 #define ECLASS_LIGHT 0x00000001
36 #define ECLASS_ANGLE 0x00000002
37 #define ECLASS_PATH 0x00000004
38 #define ECLASS_MISCMODEL 0x00000008
43 class ListAttributeType;
45 class EntityClassCollector
48 virtual void insert( EntityClass* eclass ) = 0;
49 virtual void insert( const char* name, const ListAttributeType& list ){
53 struct EntityClassScanner
55 INTEGER_CONSTANT( Version, 1 );
56 STRING_CONSTANT( Name, "eclass" );
58 void ( *scanFile )( EntityClassCollector& collector, const char* filename );
59 const char* ( *getExtension )( );
62 #include "modulesystem.h"
64 template<typename Type>
66 typedef ModuleRef<EntityClassScanner> EClassModuleRef;
68 template<typename Type>
70 typedef Modules<EntityClassScanner> EClassModules;
72 template<typename Type>
74 typedef ModulesRef<EntityClassScanner> EClassModulesRef;
81 class EntityClassVisitor
84 virtual void visit( EntityClass* eclass ) = 0;
90 struct EntityClassManager
92 INTEGER_CONSTANT( Version, 1 );
93 STRING_CONSTANT( Name, "eclassmanager" );
95 EntityClass* ( *findOrInsert )( const char* name, bool has_brushes );
96 const ListAttributeType* ( *findListType )(const char* name);
97 void ( *forEach )( EntityClassVisitor& visitor );
98 void ( *attach )( ModuleObserver& observer );
99 void ( *detach )( ModuleObserver& observer );
101 void ( *unrealise )();
104 template<typename Type>
106 typedef GlobalModule<EntityClassManager> GlobalEntityClassManagerModule;
108 template<typename Type>
109 class GlobalModuleRef;
110 typedef GlobalModuleRef<EntityClassManager> GlobalEntityClassManagerModuleRef;
112 inline EntityClassManager& GlobalEntityClassManager(){
113 return GlobalEntityClassManagerModule::getTable();