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)
54 struct EntityClassScanner
56 INTEGER_CONSTANT(Version, 1);
57 STRING_CONSTANT(Name, "eclass");
59 void (*scanFile)(EntityClassCollector& collector, const char* filename);
60 const char* (*getExtension)();
63 #include "modulesystem.h"
65 template<typename Type>
67 typedef ModuleRef<EntityClassScanner> EClassModuleRef;
69 template<typename Type>
71 typedef Modules<EntityClassScanner> EClassModules;
73 template<typename Type>
75 typedef ModulesRef<EntityClassScanner> EClassModulesRef;
82 class EntityClassVisitor
85 virtual void visit(EntityClass* eclass) = 0;
91 struct EntityClassManager
93 INTEGER_CONSTANT(Version, 1);
94 STRING_CONSTANT(Name, "eclassmanager");
96 EntityClass* (*findOrInsert)(const char* name, bool has_brushes);
97 const ListAttributeType* (*findListType)(const char* name);
98 void (*forEach)(EntityClassVisitor& visitor);
99 void (*attach)(ModuleObserver& observer);
100 void (*detach)(ModuleObserver& observer);
105 template<typename Type>
107 typedef GlobalModule<EntityClassManager> GlobalEntityClassManagerModule;
109 template<typename Type>
110 class GlobalModuleRef;
111 typedef GlobalModuleRef<EntityClassManager> GlobalEntityClassManagerModuleRef;
113 inline EntityClassManager& GlobalEntityClassManager()
115 return GlobalEntityClassManagerModule::getTable();