Handling enumerated types

The GetEnumItemValue and GetEnumItemName functions allow you to convert the name of an enumerated value to an integer value, and to convert an integer value to the name of an enumerated value.

This example gets the numeric value for the boolean! enumerated value, then uses it to return the string value:

pblong lType = session->GetEnumItemValue("object",
   boolean" ); // returns 138
LPCTSTR szEnum = session->GetEnumItemName( "object", 
   lType ); // returns "boolean"

Notice that the second argument in the GetEnumItemValue call, the enumerated value, must not have an appended exclamation mark (!).

To return an enumerated value from an extension to PowerScript, use the SetLong function to set the value of the enumerated variable into IPB_Value (you cannot use SetInt or SetShort).

To obtain an enumerated variable's value, you can use GetInt or GetShort as well as GetLong, as long as the value is in the appropriate range. For example, if you attempt to use GetInt to obtain a value that is more than 32767, the returned value is truncated.