0
|
1 // WarFoundryXmlElementNames.cs
|
|
2 //
|
|
3 // Copyright (C) 2007 IBBoard
|
|
4 //
|
|
5 // This library is free software; you can redistribute it and/or
|
|
6 // modify it under the terms of the GNU Lesser General Public
|
|
7 // License as published by the Free Software Foundation; either
|
|
8 // version 2.1 of the License, or (at your option) any later version.
|
|
9 //
|
|
10 // This library is distributed in the hope that it will be useful,
|
|
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 // Lesser General Public License for more details.
|
|
14 //
|
|
15 // You should have received a copy of the GNU Lesser General Public
|
|
16 // License along with this library; if not, write to the Free Software
|
|
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 //
|
|
19 //
|
|
20
|
|
21 using System;
|
|
22 using System.Collections.Generic;
|
|
23 using IBBoard.Xml;
|
|
24
|
|
25 namespace IBBoard.WarFoundry.API.Factories.Xml
|
|
26 {
|
|
27 /// <summary>
|
|
28 /// An enumeration class for valid WarFoundry XML elements, designed to imitate Java's extensible complex object enumerations.
|
|
29 /// </summary>
|
|
30 public class WarFoundryXmlElementName : IXmlElementName, IExtendedEnum<string>
|
|
31 {
|
|
32 public static WarFoundryXmlElementName SYSTEM_ELEMENT = new WarFoundryXmlElementName("SYSTEM_ELEMENT", "system");
|
|
33 public static WarFoundryXmlElementName ARMY_ELEMENT = new WarFoundryXmlElementName("ARMY_ELEMENT", "army");
|
|
34 public static WarFoundryXmlElementName RACE_ELEMENT = new WarFoundryXmlElementName("RACE_ELEMENT", "race");
|
|
35 public static WarFoundryXmlElementName CATEGORIES_ELEMENT = new WarFoundryXmlElementName("CATEGORIES_ELEMENT", "categories");
|
|
36 public static WarFoundryXmlElementName CATEGORY_ELEMENT = new WarFoundryXmlElementName("CATEGORY_ELEMENT", "cat");
|
|
37 public static WarFoundryXmlElementName UNITTYPES_ELEMENT = new WarFoundryXmlElementName("UNITTYPES_ELEMENT", "units");
|
|
38 public static WarFoundryXmlElementName UNITTYPE_ELEMENT = new WarFoundryXmlElementName("UNITTYPE_ELEMENT", "unit");
|
|
39 public static WarFoundryXmlElementName RACE_EQUIPMENT_ITEMS_ELEMENT = new WarFoundryXmlElementName("RACE_EQUIPMENT_ITEMS_ELEMENT", "equipment");
|
|
40 public static WarFoundryXmlElementName RACE_EQUIPMENT_ITEM_ELEMENT = new WarFoundryXmlElementName("RACE_EQUIPMENT_ITEMS_ELEMENT", "equipmentItem");
|
|
41
|
|
42 private static ICollection<WarFoundryXmlElementName> enumValues;
|
|
43 private string name;
|
|
44 private string val;
|
|
45
|
|
46 private WarFoundryXmlElementName(string elemName, string elemVal)
|
|
47 {
|
|
48 name = elemName;
|
|
49 val = elemVal;
|
|
50 }
|
|
51
|
|
52 public string Name
|
|
53 {
|
|
54 get {
|
|
55 return name;
|
|
56 }
|
|
57 }
|
|
58
|
|
59 public string Value
|
|
60 {
|
|
61 get {
|
|
62 return val;
|
|
63 }
|
|
64 }
|
|
65
|
|
66 /// <summary>
|
|
67 /// Gets an ICollection of the values so that they can be looped over like a standard enumeration.
|
|
68 /// </summary>
|
|
69 /// <returns>
|
|
70 /// A <see cref="ICollection`1"/> of all of the static 'enumeration' values of the class.
|
|
71 /// </returns>
|
|
72 public static ICollection<WarFoundryXmlElementName> GetEnumValues()
|
|
73 {
|
|
74 if (enumValues == null)
|
|
75 {
|
|
76 enumValues = new WarFoundryXmlElementName[]{SYSTEM_ELEMENT, ARMY_ELEMENT, RACE_ELEMENT, CATEGORIES_ELEMENT, CATEGORY_ELEMENT, UNITTYPES_ELEMENT, UNITTYPE_ELEMENT};
|
|
77 }
|
|
78
|
|
79 return enumValues;
|
|
80 }
|
|
81 }
|
|
82 }
|