annotate mde/setup/exception.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 66d555da083e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
1 /* LICENSE BLOCK
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
2 Part of mde: a Modular D game-oriented Engine
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
3 Copyright © 2007-2008 Diggory Hardy
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
4
26
611f7b9063c6 Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 25
diff changeset
5 This program is free software: you can redistribute it and/or modify it under the terms
611f7b9063c6 Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 25
diff changeset
6 of the GNU General Public License as published by the Free Software Foundation, either
611f7b9063c6 Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 25
diff changeset
7 version 2 of the License, or (at your option) any later version.
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
8
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
11 See the GNU General Public License for more details.
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
12
26
611f7b9063c6 Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 25
diff changeset
13 You should have received a copy of the GNU General Public License
611f7b9063c6 Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 25
diff changeset
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
15
85
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
16 /** Contains the exception classes for Init, and the StageState type to remove the need for init
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
17 * functions to import other Init modules. */
63
66d555da083e Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 26
diff changeset
18 module mde.setup.exception;
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
19
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
20 import mde.exception;
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
21
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
22 /// Thrown when Init fails.
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
23 class InitException : mdeException {
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
24 char[] getSymbol () {
63
66d555da083e Moved many modules/packages to better reflect usage.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 26
diff changeset
25 return super.getSymbol ~ ".setup.Init";
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
26 }
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
27
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
28 this (char[] msg) {
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
29 super(msg);
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
30 }
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
31 }
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
32
85
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
33 /// State of an InitStage.
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
34 enum StageState : byte {
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
35 INACTIVE = 0, /// run init on startup
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
36 ACTIVE = 1, /// run cleanup on shutdown
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
37 ERROR = -1, /// locked; don't run init or cleanup
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
38 }
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
39
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
40 /// May be thrown when an init or cleanup function fails to explicitly set the stage's state.
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
41 class InitStageException : InitException {
85
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
42 this (StageState s) {
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
43 state = s;
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
44 super("");
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
45 }
85
56c0ddd90193 Intermediate commit (not stable). Changes to init system.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 63
diff changeset
46 StageState state;
20
838577503598 Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
47 }