Mercurial > projects > mde
diff mde/lookup/Options.d @ 84:e0f1ec7fe73a
Merge plus a few tweaks.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sun, 31 Aug 2008 15:59:17 +0100 |
parents | ac1e3fd07275 |
children | 56c0ddd90193 |
line wrap: on
line diff
--- a/mde/lookup/Options.d Sat Aug 30 09:37:35 2008 +0100 +++ b/mde/lookup/Options.d Sun Aug 31 15:59:17 2008 +0100 @@ -14,11 +14,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** This module handles stored options, currently all except input maps. -* -* The purpose of having all options centrally controlled is to allow generic handling by the GUI -* and ease saving and loading of values. The Options class is only really designed around handling -* small numbers of variables for now. -*/ + * + * The purpose of having all options centrally controlled is to allow generic handling by the GUI + * and ease saving and loading of values. The Options class is only really designed around handling + * small numbers of variables for now. + * + * Note: This module uses some non-spec functionality, which "works for me", but may need to be + * changed if it throws up problems. Specifically: templated virtual functions (Options.set, get + * and list), and accessing private templates from an unrelated class (Options.TName, TYPES). + * OptionChanges used to have a templated set member function (used by Options.set), which caused + * linker problems when the module wasn't compiled from scratch. + */ module mde.lookup.Options; import mde.setup.paths; @@ -50,8 +56,18 @@ * Further to this, a generic class is used to store all options which have been changed, and if any * have been changed, is merged with options from the user conf dir and saved on exit. */ +/* An idea for potentially extending Options, but which doesn't seem necessary now: +Move static code from Options to an OptionSet class, which may be sub-classed. These sub-classes +may be hooked in to the master OptionSet class to shadow all Options classes and be notified of +changes, and may or may not have values loaded from files during init. Change-sets could be +rewritten to use this. +However, only the changesets should need to be notified of each change (gui interfaces could simply +be notified that a change occured and redraw everything; users of options can just re-take their +values every time they use them). */ class Options : IDataSection { + protected this() {} /// Do not instantiate directly. + // All supported types, for generic handling via templates. It should be possible to change // the supported types simply by changing this list now (untested). template store(A...) { alias A store; }