Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
Qualifier.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.Text;
5 
6 namespace SiliconStudio.Shaders.Ast
7 {
8  /// <summary>
9  /// A Storage qualifier.
10  /// </summary>
11  public class Qualifier : CompositeEnum
12  {
13  #region Constants and Fields
14 
15  /// <summary>
16  /// None Enum.
17  /// </summary>
18  public static readonly Qualifier None = new Qualifier(string.Empty);
19 
20  #endregion
21 
22  #region Constructors and Destructors
23 
24  /// <summary>
25  /// Initializes a new instance of the <see cref = "Qualifier" /> class.
26  /// </summary>
27  public Qualifier()
28  : base(true)
29  {
30  }
31 
32  /// <summary>
33  /// Initializes a new instance of the <see cref="Qualifier"/> class.
34  /// </summary>
35  /// <param name="key">
36  /// Name of the enum.
37  /// </param>
38  protected Qualifier(object key)
39  : base(key, true)
40  {
41  }
42  #endregion
43 
44  #region Operators
45 
46  /// <summary>
47  /// Gets or sets a value indicating whether this instance is a post qualifier.
48  /// </summary>
49  /// <value>
50  /// <c>true</c> if this instance is a post qualifier; otherwise, <c>false</c>.
51  /// </value>
52  public bool IsPost { get; set; }
53 
54  /// <summary>
55  /// Implements the operator ==.
56  /// </summary>
57  /// <param name = "left">The left.</param>
58  /// <param name = "right">The right.</param>
59  /// <returns>
60  /// The result of the operator.
61  /// </returns>
62  public static Qualifier operator &(Qualifier left, Qualifier right)
63  {
64  return OperatorAnd(left, right);
65  }
66 
67  /// <summary>
68  /// Implements the operator |.
69  /// </summary>
70  /// <param name = "left">The left.</param>
71  /// <param name = "right">The right.</param>
72  /// <returns>
73  /// The result of the operator.
74  /// </returns>
75  public static Qualifier operator |(Qualifier left, Qualifier right)
76  {
77  return OperatorOr(left, right);
78  }
79 
80  /// <summary>
81  /// Implements the operator ^.
82  /// </summary>
83  /// <param name = "left">The left.</param>
84  /// <param name = "right">The right.</param>
85  /// <returns>
86  /// The result of the operator.
87  /// </returns>
88  public static Qualifier operator ^(Qualifier left, Qualifier right)
89  {
90  return OperatorXor(left, right);
91  }
92 
93  public string ToString(bool isPost)
94  {
95  var strBuild = new StringBuilder();
96  var str = ToString<Qualifier>(qualifier => qualifier.IsPost == isPost);
97  if (!string.IsNullOrEmpty(str))
98  {
99  if (isPost)
100  {
101  strBuild.Append(" ");
102  strBuild.Append(str);
103  }
104  else
105  {
106  strBuild.Append(str);
107  strBuild.Append(" ");
108  }
109  return strBuild.ToString();
110  }
111 
112  return string.Empty;
113  }
114 
115  #endregion
116  }
117 }
Qualifier()
Initializes a new instance of the Qualifier class.
Definition: Qualifier.cs:27
Qualifier(object key)
Initializes a new instance of the Qualifier class.
Definition: Qualifier.cs:38
string ToString(bool isPost)
Definition: Qualifier.cs:93