Mercurial > projects > mde
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 |
rev | line source |
---|---|
20 | 1 /* LICENSE BLOCK |
2 Part of mde: a Modular D game-oriented Engine | |
3 Copyright © 2007-2008 Diggory Hardy | |
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 | 8 |
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | |
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
11 See the GNU General Public License for more details. | |
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 | 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 | 19 |
20 import mde.exception; | |
21 | |
22 /// Thrown when Init fails. | |
23 class InitException : mdeException { | |
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 | 26 } |
27 | |
28 this (char[] msg) { | |
29 super(msg); | |
30 } | |
31 } | |
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 | 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 | 44 super(""); |
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 | 47 } |