Example #1
0
 /// <summary>
 /// Copies an instance of a flag
 /// </summary>
 /// <param name="flag">Flag to copy</param>
 public Flag(Flag flag)
 {
     Value = flag.Value;
 }
Example #2
0
 /// <summary>
 /// Creates a new flag by joining this instance with another flag.
 /// </summary>
 /// <param name="flag">Flag to join</param>
 /// <returns>The joined flags</returns>
 public Flag MergeNew(Flag flag)
 {
     return(new Flag(this, flag));
 }
Example #3
0
 /// <summary>
 /// Checks if this instance matches another flag exactly.
 /// </summary>
 /// <param name="flag">Flag to check</param>
 /// <returns>If the flag exactly matches or not</returns>
 /// <example>
 /// The following is an example of a match using binary notation:
 /// <code>
 ///     (param) 0110_0100 == (instance) 0110_0100
 /// </code>
 /// This is an example of a non-match:
 /// <code>
 ///     (param) 0000_0100 == (instance) 0110_0100
 /// </code>
 /// </example>
 public bool MatchExact(Flag flag)
 {
     return(MatchExact(flag.Value));
 }
Example #4
0
 /// <summary>
 /// Checks if this instance matches another flag.
 /// </summary>
 /// <param name="flag">Flag to check</param>
 /// <returns>If the flag matches or not</returns>
 /// <example>
 /// The following is an example of a match using binary notation:
 /// <code>
 ///     (param) 0000_0100 == (instance) 0110_0100
 /// </code>
 /// This is an example of a non-match:
 /// <code>
 ///     (param) 0000_1000 == (instance) 0110_0100
 /// </code>
 /// </example>
 public bool Match(Flag flag)
 {
     return(Match(flag.Value));
 }
Example #5
0
 /// <summary>
 /// Removes a flag markers from this instance
 /// </summary>
 /// <param name="flag">Flag to remove</param>
 /// <example>
 /// The following is an example of a remove operation:
 /// <code>
 ///     Flag a = new Flag(0b0000_0110);
 ///     a.Remove(0b0000_0100);
 ///
 ///     a == 0b0000_0010
 /// </code>
 /// </example>
 public void Remove(Flag flag)
 {
     Remove(flag.Value);
 }
Example #6
0
 /// <summary>
 /// Joins a flag into this instance
 /// </summary>
 /// <param name="flags">Flag to combine</param>
 /// <example>
 /// The following is an example of a merge operation:
 /// <code>
 ///     Flag a = new Flag(0b0000_1111);
 ///     a.Join(0b1111_0000);
 ///
 ///     a == 0b1111_1111
 /// </code>
 /// </example>
 public void Merge(Flag flag)
 {
     Value |= flag.Value;
 }
Example #7
0
 /// <summary>
 /// Sets this flag to another flag.
 /// </summary>
 /// <param name="flag">Flag to set</param>
 /// <example>
 /// The following is an example of a set operation:
 /// <code>
 ///     Flag a = new Flag(0b0000_1111);
 ///     a.Set(0b1100_0000);
 ///
 ///     a == 0b1100_0000
 /// </code>
 /// </example>
 public void Set(Flag flag)
 {
     Value = flag.Value;
 }