comparison mde/input/Config.d @ 85:56c0ddd90193

Intermediate commit (not stable). Changes to init system.
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 11 Sep 2008 11:33:51 +0100
parents e0f1ec7fe73a
children 79d816b3e2d2
comparison
equal deleted inserted replaced
84:e0f1ec7fe73a 85:56c0ddd90193
22 import mde.setup.paths; 22 import mde.setup.paths;
23 import mde.file.deserialize; 23 import mde.file.deserialize;
24 debug import mde.file.serialize; 24 debug import mde.file.serialize;
25 25
26 import tango.util.log.Log : Log, Logger; 26 import tango.util.log.Log : Log, Logger;
27 import tango.util.collection.TreeBag : TreeBag; 27 import tango.util.container.HashSet;
28 28
29 /** Class to hold the configuration for the input system. Thus loading and switching between 29 /** Class to hold the configuration for the input system. Thus loading and switching between
30 * multiple configurations should be easy. 30 * multiple configurations should be easy.
31 * 31 *
32 * Class extends DataSection so that it can be loaded by mergetag easily. 32 * Class extends DataSection so that it can be loaded by mergetag easily.
113 // FIXME: 113 // FIXME:
114 char[] name; /// Name for user to save this under. 114 char[] name; /// Name for user to save this under.
115 uint[] inheritants; /// Other profiles to inherit. 115 uint[] inheritants; /// Other profiles to inherit.
116 116
117 static Config[char[]] configs; /// All configs loaded by load(). 117 static Config[char[]] configs; /// All configs loaded by load().
118 private static TreeBag!(char[]) loadedFiles; // all filenames load tried to read 118 private static HashSet!(char[]) loadedFiles; // all filenames load tried to read
119 private static Logger logger; 119 private static Logger logger;
120 120
121 //BEGIN File loading/saving code 121 //BEGIN File loading/saving code
122 static this () { 122 static this () {
123 logger = Log.getLogger ("mde.input.Config"); 123 logger = Log.getLogger ("mde.input.Config");
124 loadedFiles = new TreeBag!(char[]); 124 loadedFiles = new HashSet!(char[]);
125 } 125 }
126 126
127 // Load all configs from a file. 127 // Load all configs from a file.
128 static void load (char[] filename) { 128 static void load (char[] filename) {
129 if (loadedFiles.contains (filename)) return; // forget it; already done that 129 if (loadedFiles.contains (filename)) return; // forget it; already done that