Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
InterfaceType.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;
4 using System.Collections;
5 using System.Collections.Generic;
6 
7 namespace SiliconStudio.Shaders.Ast.Hlsl
8 {
9  /// <summary>
10  /// Definition of a class.
11  /// </summary>
13  {
14  #region Constructors and Destructors
15 
16  /// <summary>
17  /// Initializes a new instance of the <see cref = "InterfaceType" /> class.
18  /// </summary>
19  public InterfaceType()
20  : this(null)
21  {
22  }
23 
24  /// <summary>
25  /// Initializes a new instance of the <see cref="InterfaceType"/> class.
26  /// </summary>
27  /// <param name="name">
28  /// The name.
29  /// </param>
30  public InterfaceType(string name)
31  : base(name)
32  {
33  Methods = new List<MethodDeclaration>();
34  GenericParameters = new List<TypeBase>();
35  GenericArguments = new List<TypeBase>();
36  }
37 
38  #endregion
39 
40  #region Public Properties
41 
42  /// <inheritdoc/>
43  public List<TypeBase> GenericParameters { get; set; }
44 
45  /// <inheritdoc/>
46  public List<TypeBase> GenericArguments { get; set; }
47 
48  /// <summary>
49  /// Gets or sets the methods.
50  /// </summary>
51  /// <value>
52  /// The methods.
53  /// </value>
54  public List<MethodDeclaration> Methods { get; set; }
55 
56  #endregion
57 
58  #region Public Methods
59 
60  /// <inheritdoc />
61  public override IEnumerable<Node> Childrens()
62  {
63  ChildrenList.Clear();
64  ChildrenList.Add(Name);
65  ChildrenList.AddRange(Methods);
66  return ChildrenList;
67  }
68 
69  /// <inheritdoc />
70  public override string ToString()
71  {
72  return string.Format("interface {0} {{...}}", Name);
73  }
74 
75  /// <inheritdoc/>
76  public bool Equals(InterfaceType other)
77  {
78  return base.Equals(other);
79  }
80 
81  /// <inheritdoc/>
82  public override bool Equals(object obj)
83  {
84  if (ReferenceEquals(null, obj))
85  {
86  return false;
87  }
88  if (ReferenceEquals(this, obj))
89  {
90  return true;
91  }
92  return Equals(obj as InterfaceType);
93  }
94 
95  /// <inheritdoc/>
96  public override int GetHashCode()
97  {
98  return base.GetHashCode();
99  }
100 
101  /// <summary>
102  /// Implements the operator ==.
103  /// </summary>
104  /// <param name="left">The left.</param>
105  /// <param name="right">The right.</param>
106  /// <returns>
107  /// The result of the operator.
108  /// </returns>
109  public static bool operator ==(InterfaceType left, InterfaceType right)
110  {
111  return Equals(left, right);
112  }
113 
114  /// <summary>
115  /// Implements the operator !=.
116  /// </summary>
117  /// <param name="left">The left.</param>
118  /// <param name="right">The right.</param>
119  /// <returns>
120  /// The result of the operator.
121  /// </returns>
122  public static bool operator !=(InterfaceType left, InterfaceType right)
123  {
124  return !Equals(left, right);
125  }
126 
127  #endregion
128  }
129 }
An interface used by generic definitions and instance.
Definition: IGenerics.cs:10
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
InterfaceType(string name)
Initializes a new instance of the InterfaceType class.
Toplevel interface for a declaration.
Definition: IDeclaration.cs:8
InterfaceType()
Initializes a new instance of the InterfaceType class.