Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
CaseStatement.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
8 {
9  /// <summary>
10  /// A single case or default statement.
11  /// </summary>
12  public class CaseStatement : Statement
13  {
14  #region Constructors and Destructors
15 
16  /// <summary>
17  /// Initializes a new instance of the <see cref = "CaseStatement" /> class.
18  /// </summary>
19  public CaseStatement()
20  {
21  }
22 
23  /// <summary>
24  /// Initializes a new instance of the <see cref="CaseStatement"/> class.
25  /// </summary>
26  /// <param name="case">
27  /// The @case.
28  /// </param>
29  public CaseStatement(Expression @case)
30  {
31  Case = @case;
32  }
33 
34  #endregion
35 
36  #region Public Properties
37 
38  /// <summary>
39  /// Gets or sets the case.
40  /// </summary>
41  /// <value>
42  /// The case.
43  /// </value>
44  /// <remarks>
45  /// If this property is null, this is a default statement.
46  /// </remarks>
47  public Expression Case { get; set; }
48 
49  #endregion
50 
51  #region Public Methods
52 
53  /// <inheritdoc />
54  public override IEnumerable<Node> Childrens()
55  {
56  ChildrenList.Clear();
57  if (Case != null)
58  {
59  ChildrenList.Add(Case);
60  }
61 
62  return ChildrenList;
63  }
64 
65  /// <inheritdoc />
66  public override string ToString()
67  {
68  return Case == null ? "default:" : string.Format("case {0}:", Case);
69  }
70 
71  #endregion
72  }
73 }
CaseStatement(Expression @case)
Initializes a new instance of the CaseStatement class.
Base root class for all statements.
Definition: Statement.cs:11
CaseStatement()
Initializes a new instance of the CaseStatement class.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
A single case or default statement.