Class Options
The base class for a collection of 32 flag bits.
public abstract class Options
- Inheritance
-
Options
- Derived
- Inherited Members
Remarks
The base class for a collection of 32 flag bits. Individual flags are defined as enum value bit masks. Inheriting classes add convenience accessor methods.
Constructors
Options()
The default constructor.
public Options()
Options(int)
Constructor with the options bit mask.
public Options(int options)
Parameters
options
intthe options bit mask
Methods
AssertConsistency(int)
The inheriting option class can do additional checks on the options.
protected virtual void AssertConsistency(int options)
Parameters
options
intthe bitmask to check.
Remarks
The inheriting option class can do additional checks on the options. Note: For performance reasons this method is only called when setting bitmasks directly. When get- and set-methods are used, this method must be called manually, normally only when the Options-object has been created from a client (it has to be made public therefore).
Clear()
Resets the options.
public virtual void Clear()
ContainsAllOptions(int)
public virtual bool ContainsAllOptions(int optionBits)
Parameters
optionBits
intan option bitmask
Returns
- bool
Returns true, if this object contains all given options.
ContainsOneOf(int)
public virtual bool ContainsOneOf(int optionBits)
Parameters
optionBits
intan option bitmask
Returns
- bool
Returns true, if this object contain at least one of the given options.
DefineOptionName(int)
To be implemeted by inheritants.
protected abstract string DefineOptionName(int option)
Parameters
option
inta single, valid option bit.
Returns
- string
Returns a human readable name for an option bit.
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
- See Also
GetHashCode()
public override int GetHashCode()
Returns
- See Also
GetOption(int)
protected virtual bool GetOption(int optionBit)
Parameters
optionBit
intthe binary bit or bits that are requested
Returns
- bool
Returns if all of the requested bits are set or not.
GetOptions()
Is friendly to access it during the tests.
public virtual int GetOptions()
Returns
- int
Returns the options.
GetOptionsString()
Creates a human readable string from the set options.
public virtual string GetOptionsString()
Returns
- string
Returns a String listing all options that are set to
true
by their name, like "option1 | option4".
Remarks
Creates a human readable string from the set options. Note: This method is quite expensive and should only be used within tests or as
GetValidOptions()
To be implemeted by inheritants.
protected abstract int GetValidOptions()
Returns
- int
Returns a bit mask where all valid option bits are set.
IsExactly(int)
public virtual bool IsExactly(int optionBits)
Parameters
optionBits
intan option bitmask
Returns
- bool
Returns true, if this object is equal to the given options.
SetOption(int, bool)
public virtual void SetOption(int optionBits, bool value)
Parameters
optionBits
intthe binary bit or bits that shall be set to the given value
value
boolthe boolean value to set
SetOptions(int)
public virtual void SetOptions(int options)
Parameters
options
intThe options to set.
ToString()
public override string ToString()
Returns
- string
Returns the options as hex bitmask.