Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
EnumType.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System.Collections.Generic;
4 
5 using SiliconStudio.Shaders.Ast;
6 
7 namespace SiliconStudio.Paradox.Shaders.Parser.Ast
8 {
9  /// <summary>
10  /// An enum.
11  /// </summary>
13  {
14  #region Constructors and Destructors
15 
16  /// <summary>
17  /// Initializes a new instance of the <see cref = "EnumType" /> class.
18  /// </summary>
19  public EnumType()
20  {
21  Values = new List<Expression>();
22  }
23 
24  #endregion
25 
26  #region Public Properties
27 
28  /// <summary>
29  /// Gets or sets the fields.
30  /// </summary>
31  /// <value>
32  /// The fields.
33  /// </value>
34  public List<Expression> Values { get; set; }
35 
36  #endregion
37 
38  #region Public Methods
39 
40  /// <inheritdoc />
41  public override IEnumerable<Node> Childrens()
42  {
43  ChildrenList.Clear();
44  ChildrenList.Add(Name);
45  ChildrenList.AddRange(Values);
46  return ChildrenList;
47  }
48 
49  /// <inheritdoc />
50  public override string ToString()
51  {
52  return string.Format("enum {0} {{...}}", Name);
53  }
54 
55  /// <inheritdoc/>
56  public bool Equals(EnumType other)
57  {
58  return base.Equals(other);
59  }
60 
61  /// <inheritdoc/>
62  public override bool Equals(object obj)
63  {
64  if (ReferenceEquals(null, obj))
65  {
66  return false;
67  }
68  if (ReferenceEquals(this, obj))
69  {
70  return true;
71  }
72  return Equals(obj as EnumType);
73  }
74 
75  /// <inheritdoc/>
76  public override int GetHashCode()
77  {
78  return base.GetHashCode();
79  }
80 
81  public static bool operator ==(EnumType left, EnumType right)
82  {
83  return Equals(left, right);
84  }
85 
86  public static bool operator !=(EnumType left, EnumType right)
87  {
88  return !Equals(left, right);
89  }
90 
91  #endregion
92  }
93 }
A tag interface to identify a container for scope declarations.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
Definition: EnumType.cs:41
Base type for all types.
Definition: TypeBase.cs:11
EnumType()
Initializes a new instance of the EnumType class.
Definition: EnumType.cs:19
Toplevel interface for a declaration.
Definition: IDeclaration.cs:8