/// <summary> /// Clear all context flags on the context /// </summary> /// <param name="_flag"></param> public void ClearFlag(EContextFields _flag) { if (this == Global) { return; } m_existsFields &= ~_flag; }
/// <summary> /// Get a context flag from the context. /// </summary> /// <param name="_field">The flag to get</param> /// <returns>True or False, depending the state of the flag requested</returns> internal bool GetFlag(EContextFields _field) { if (m_parent == null || IsSet(m_existsFields, _field)) { // return this instance's context IF there's no parent OR the field exists in this context return(IsSet(m_instanceFields, _field)); } else { return(m_parent.GetFlag(_field)); } }
internal void SetFlag(EContextFields _field, bool _state) { m_existsFields |= _field; if (_state) { m_instanceFields |= _field; } else { m_instanceFields &= ~_field; } }
private static bool IsSet(EContextFields _set, EContextFields _field) => ((ushort)_set & (ushort)_field) != 0;