Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
WhileStatement.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  /// While and Do-While statement.
11  /// </summary>
13  {
14  #region Public Properties
15 
16  /// <summary>
17  /// Gets or sets the condition.
18  /// </summary>
19  /// <value>
20  /// The condition.
21  /// </value>
22  public Expression Condition { get; set; }
23 
24  /// <summary>
25  /// Gets or sets a value indicating whether this instance is a do while.
26  /// </summary>
27  /// <value>
28  /// <c>true</c> if this instance is a do while; otherwise, <c>false</c>.
29  /// </value>
30  public bool IsDoWhile { get; set; }
31 
32  /// <summary>
33  /// Gets or sets the statement.
34  /// </summary>
35  /// <value>
36  /// The statement.
37  /// </value>
38  public Statement Statement { get; set; }
39 
40  #endregion
41 
42  #region Public Methods
43 
44  /// <inheritdoc />
45  public override IEnumerable<Node> Childrens()
46  {
47  ChildrenList.Clear();
48  ChildrenList.Add(Condition);
49  ChildrenList.Add(Statement);
50  return ChildrenList;
51  }
52 
53  /// <inheritdoc />
54  public override string ToString()
55  {
56  if (IsDoWhile)
57  {
58  return string.Format("do {{...}} while ({0})", Condition);
59  }
60 
61  return string.Format("while ({0}) {{...}}", Condition);
62  }
63 
64  #endregion
65  }
66 }
While and Do-While statement.
A tag interface to identify a container for scope declarations.
Base root class for all statements.
Definition: Statement.cs:11
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes