Mercurial > repos > IBBoard.WarFoundry.API
comparison API/Factories/Xml/WarFoundryXmlElementName.cs @ 337:3c4a6403a88c
* Fix capitalisation so that new files are in the namespace
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 03 Apr 2011 18:50:32 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
336:3631c1493c7f | 337:3c4a6403a88c |
---|---|
1 // This file (WarFoundryXmlElementName.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard. | |
2 // | |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | |
4 | |
5 using System; | |
6 using System.Collections.Generic; | |
7 using IBBoard.Xml; | |
8 | |
9 namespace IBBoard.WarFoundry.API.Factories.Xml | |
10 { | |
11 /// <summary> | |
12 /// An enumeration class for valid WarFoundry XML elements, designed to imitate Java's extensible complex object enumerations. | |
13 /// </summary> | |
14 public class WarFoundryXmlElementName : IXmlElementName, IExtendedEnum<string> | |
15 { | |
16 public static WarFoundryXmlElementName SYSTEM_ELEMENT = new WarFoundryXmlElementName("SYSTEM_ELEMENT", "system"); | |
17 public static WarFoundryXmlElementName ARMY_ELEMENT = new WarFoundryXmlElementName("ARMY_ELEMENT", "army"); | |
18 public static WarFoundryXmlElementName RACE_ELEMENT = new WarFoundryXmlElementName("RACE_ELEMENT", "race"); | |
19 public static WarFoundryXmlElementName ARMY_DEFAULTNAME_ELEMENT = new WarFoundryXmlElementName("ARMY_DEFAULTNAME_ELEMENT", "defaultName"); | |
20 public static WarFoundryXmlElementName CATEGORIES_ELEMENT = new WarFoundryXmlElementName("CATEGORIES_ELEMENT", "categories"); | |
21 public static WarFoundryXmlElementName CATEGORY_ELEMENT = new WarFoundryXmlElementName("CATEGORY_ELEMENT", "cat"); | |
22 public static WarFoundryXmlElementName UNITTYPES_ELEMENT = new WarFoundryXmlElementName("UNITTYPES_ELEMENT", "units"); | |
23 public static WarFoundryXmlElementName UNITTYPE_ELEMENT = new WarFoundryXmlElementName("UNITTYPE_ELEMENT", "unit"); | |
24 public static WarFoundryXmlElementName RACE_EQUIPMENT_ITEMS_ELEMENT = new WarFoundryXmlElementName("RACE_EQUIPMENT_ITEMS_ELEMENT", "equipment"); | |
25 public static WarFoundryXmlElementName RACE_EQUIPMENT_ITEM_ELEMENT = new WarFoundryXmlElementName("RACE_EQUIPMENT_ITEMS_ELEMENT", "equipmentItem"); | |
26 | |
27 private static ICollection<WarFoundryXmlElementName> enumValues; | |
28 private string name; | |
29 private string val; | |
30 | |
31 private WarFoundryXmlElementName(string elemName, string elemVal) | |
32 { | |
33 name = elemName; | |
34 val = elemVal; | |
35 } | |
36 | |
37 public string Name | |
38 { | |
39 get { | |
40 return name; | |
41 } | |
42 } | |
43 | |
44 public string Value | |
45 { | |
46 get { | |
47 return val; | |
48 } | |
49 } | |
50 | |
51 /// <summary> | |
52 /// Gets an ICollection of the values so that they can be looped over like a standard enumeration. | |
53 /// </summary> | |
54 /// <returns> | |
55 /// A <see cref="ICollection`1"/> of all of the static 'enumeration' values of the class. | |
56 /// </returns> | |
57 public static ICollection<WarFoundryXmlElementName> GetEnumValues() | |
58 { | |
59 if (enumValues == null) | |
60 { | |
61 enumValues = new WarFoundryXmlElementName[]{SYSTEM_ELEMENT, ARMY_ELEMENT, RACE_ELEMENT, CATEGORIES_ELEMENT, CATEGORY_ELEMENT, UNITTYPES_ELEMENT, UNITTYPE_ELEMENT}; | |
62 } | |
63 | |
64 return enumValues; | |
65 } | |
66 } | |
67 } |