From 71fd3086bd45e5c9394f88fe441ff410d32cdf7b Mon Sep 17 00:00:00 2001 From: Donny Viszneki Date: Wed, 13 Aug 2014 14:47:32 -0700 Subject: [PATCH] dlangui.core.stdaction module now uses immutable and static module initializer --- src/dlangui/core/stdaction.d | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/dlangui/core/stdaction.d b/src/dlangui/core/stdaction.d index 0cc005a7..3163890c 100644 --- a/src/dlangui/core/stdaction.d +++ b/src/dlangui/core/stdaction.d @@ -32,15 +32,27 @@ enum StandardAction : int { Save, } -__gshared const Action ACTION_OK = new Action(StandardAction.Ok, "ACTION_OK"c); -__gshared const Action ACTION_CANCEL = new Action(StandardAction.Cancel, "ACTION_CANCEL"c); -__gshared const Action ACTION_YES = new Action(StandardAction.Yes, "ACTION_YES"c); -__gshared const Action ACTION_NO = new Action(StandardAction.No, "ACTION_NO"c); -__gshared const Action ACTION_CLOSE = new Action(StandardAction.Close, "ACTION_CLOSE"c); -__gshared const Action ACTION_ABORT = new Action(StandardAction.Abort, "ACTION_ABORT"c); -__gshared const Action ACTION_RETRY = new Action(StandardAction.Retry, "ACTION_RETRY"c); -__gshared const Action ACTION_IGNORE = new Action(StandardAction.Ignore, "ACTION_IGNORE"c); -__gshared const Action ACTION_OPEN = new Action(StandardAction.Open, "ACTION_OPEN"c); -__gshared const Action ACTION_SAVE = new Action(StandardAction.Save, "ACTION_SAVE"c); - +immutable Action ACTION_OK; +immutable Action ACTION_CANCEL; +immutable Action ACTION_YES; +immutable Action ACTION_NO; +immutable Action ACTION_CLOSE; +immutable Action ACTION_ABORT; +immutable Action ACTION_RETRY; +immutable Action ACTION_IGNORE; +immutable Action ACTION_OPEN; +immutable Action ACTION_SAVE; +static this() +{ + ACTION_OK = cast(immutable(Action)) new Action(StandardAction.Ok, "ACTION_OK"c); + ACTION_CANCEL = cast(immutable(Action)) new Action(StandardAction.Cancel, "ACTION_CANCEL"c); + ACTION_YES = cast(immutable(Action)) new Action(StandardAction.Yes, "ACTION_YES"c); + ACTION_NO = cast(immutable(Action)) new Action(StandardAction.No, "ACTION_NO"c); + ACTION_CLOSE = cast(immutable(Action)) new Action(StandardAction.Close, "ACTION_CLOSE"c); + ACTION_ABORT = cast(immutable(Action)) new Action(StandardAction.Abort, "ACTION_ABORT"c); + ACTION_RETRY = cast(immutable(Action)) new Action(StandardAction.Retry, "ACTION_RETRY"c); + ACTION_IGNORE = cast(immutable(Action)) new Action(StandardAction.Ignore, "ACTION_IGNORE"c); + ACTION_OPEN = cast(immutable(Action)) new Action(StandardAction.Open, "ACTION_OPEN"c); + ACTION_SAVE = cast(immutable(Action)) new Action(StandardAction.Save, "ACTION_SAVE"c); +}