MfEnum

Namespace ›› System ››
Parent Previous Next

MfEnum Class

(Inherits from MfValueType)

Abstract class.
Provides implementation methods and properties for Enum type classes

Links

Properties, Methods, EnumItem

Constructors


Name

Description

Constructor()

Creates a new instance derived from MfEnum class and set initial value to zero.

Constructor(num)

Creates a new instance derived from MfEnum class and sets initial value to value of num.

Constructor(instanceEnum)

Creates a new instance derived from MfEnum class an set the intial value to the value of instanceEnum.

Constructor(enumItem)

Creates a new instance of derived class and set its value to the MfEnum.EnumItem instance value.

Properties


Name

Description

Instance

Gets the Singleton instance of the class.

MaxValue

Gets a var value representing the Maximum value of all the EnumItem instances in an MfEnum instance as a var containing integer.

Value

Gets or sets the value associated with the derived MfEnum class.

Methods


Name

Description

AddAttribute()

Adds MfAttribute extended items to extended classes. Inherited from MfObject.

AddEnums()

Processes adding of new MfEnum values to derived class

AddEnumValue(name, value)

Adds new Enum Name to MfEnum derived class that represents an instance of MfEnum.EnumItem.

AddFlag(flag)

Adds a flag value to the current Value of MfEnum instance.

CompareTo(obj)

Compares the current instance with another object derived from MfEnum or MfEnum.EnumItem Instance and returns an integer that indicates whether the current instance Value precedes, follows, or occurs in the same position in the sort order as the other object. Overrides MfObject.CompareTo()

DestroyInstance()

Set current instance of MfEnum derived class to null.

Equals(objA)

Compares objA against current MfEnum instance to see if they have the same Value. Overrides MfObject.Equals

Equals(objA, objB)

Compares objA against objB to see if they have the same value. Overrides MfObject.Equals

GetAttribute(index)

Gets an MfAttribute of the class. Inherited from MfObject.

GetAttributes()

Gets a MfGenericList of MfAttribute that Contains the attributes for the current class instance. Inherited from MfObject.

GetHashCode()

Gets A hash code for the current MfEnum. Overrides MfObject.GetHashCode(). Overrides MfObject.GetHashCode.

GetIndexOfAttribute(attrib)

Gets the zero-based index value of the position of MfAttribute within the instance of the class. Inherited from MfObject.

GetInstance()

Abstract method. Gets the instance of the Singleton

GetNames()

Gets a of MfGenericList of MfString containing all enumeration names of derived MfEnum class.

GetType()

Gets the Type for the for the Class .Inherited from MfObject.

GetTypeCode()

Get an enumeration value of MfTypeCode the represents MfEnum Type Code.

GetValues()

Gets a MfGenericList of MfInteger containing values of derived MfEnum class.

HasAttribute(attrib)

Gets if the current instance of class derived from MfSystemException has MfAttribute. Inherited from MfObject.

HasFlag(flag)

Gets if the MfEnum extended class has a flag set

Is(type[, IncludeEnumItem])

Gets if current instance of object is of the same type. Overrides MfObject.Is()

IsInstance()

Get if the current class is an instance. Inherited from MfObject.

MemberwiseClone()

Creates a shallow copy of the current MfObject instance. Inherited from MfObject.

Parse(enumType, value)

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. Case is ignored for the value.

Parse(enumType, value, ignoreCase)

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. the ignoreCase parameter specifies whether the operation is case-insensitive

ParseItem(enumType, value)

Converts the string representation of the name or numeric value of one enumerated constants to an equivalent MfEnum.EnumItem for the enumeration represented by enumType. Case is ignored for the value.

ParseItem(enumType, value, ignoreCase)

Converts the string representation of the name or numeric value of one enumerated constants to an equivalent MfEnum.EnumItem. for the enumeration represented by enumType. ignoreCase parameter specifies if the operation is case-insensitive

RemoveFlag(flag)

Removes a flag value from the current Value of MfEnum instance.

ToObject(enumType, value)

Converts the specified Integer to an enumeration member

ToString()

Gets a string representation of the object.. Overrides MfObject.ToString()

TryParse(value, outEnum)

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. The return value indicates whether the conversion succeeded. This method is case-insensitive.

TryParse(value, outEnum, ignoreCase)

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. A parameter specifies whether the operation is case-sensitive. The return value indicates whether the conversion succeeded.

TryParseItem(enumType, value, outEnumItem)

Converts the string representation of the name or numeric value of one enumerated constants to an equivalent MfEnum.EnumItem for the enumeration represented by enumType. and assign the value to outEnumItem. Case is ignored for the value.

TryParseItem(enumType, value, outEnumItem, ignoreCase)

Converts the string representation of the name or numeric value of one enumerated constants to an equivalent MfEnum.EnumItem for the enumeration represented by enumType. and assigne the value to outEnumItem. ignoreCase parameter specifies if the operation is case-insensitive.

VerifyIsInstance([ClassName, LineFile, LineNumber, Source])

Verifies the the current object is set to an instance. Inherited from MfObject.

VerifyIsNotInstance([MethodName, LineFile, LineNumber, Source])

Verifies the the current object is NOT set to an instance. Used in Static methods. Inherited from MfObject.

Example

; create a new enumeration class by inheriting/extending the MfEnum
class RegOptEnum extends MfEnum
{
   static m_Instance := MfNull.Null
   __New(args*)
   {
       if (this.base.__Class != "RegOptEnum")
       {
           throw new MfNotSupportedException(MfEnvironment.Instance.GetResourceString("NotSupportedException_Sealed_Class"
               ,"RegOptEnum"))
       }
       base.__New(args*)
       ; set MfObject m_isInherited flag for testing if Class is inherited/extended if needed
       ; This could be set to false as this class cannot be inherited/extended as set in this constructor above
       ; but will do it the standard way.
       this.m_isInherited := this.__Class != "RegOptEnum"
   }
       
   ; override the base AddEnums, this is required
   ; add all the enum values for your enum here
   AddEnums() {
       this.AddEnumValue("RegDword", 0)
       this.AddEnumValue("KeysRegDword", 1)
       this.AddEnumValue("RegSz", 2)
       this.AddEnumValue("KeysRegSz", 3)
       this.AddEnumValue("RegBinary", 4)
       this.AddEnumValue("KeysRegBinary", 5)
       this.AddEnumValue("AutoresponseRegSz", 6)
       this.AddEnumValue("KeysAutoresponseRegSz", 7)
       this.AddEnumValue("AutoupdateRegSz", 8)
       this.AddEnumValue("KeysAutoupdateRegSz", 9)
       this.AddEnumValue("AutoupdateRegBinary", 10)
       this.AddEnumValue("KeysAutoupdateRegBinary", 11)
       this.AddEnumValue("KeypathsRegSz", 12)
       this.AddEnumValue("KeysKeypathsRegSz", 13)
       this.AddEnumValue("KeypathsRegDword", 14)
       this.AddEnumValue("KeysKeypathsRegDword", 15)
       this.AddEnumValue("WindowplacementRegBinary", 16)
       this.AddEnumValue("KeysWindowplacementRegBinary", 17)
   }

   ; override the base DestroyInstance, this is required
   DestroyInstance() {
       RegOptEnum.m_Instance := Null        
   }

   ; override the base GetInstance, this is required
   ; Get a static default instance, create if not exist yet
   GetInstance() {
       if (MfNull.IsNull(RegOptEnum.m_Instance))
       {
           RegOptEnum.m_Instance := new RegOptEnum(0)
       }
       return RegOptEnum.m_Instance
   }
}