Open CASCADE Technology  7.5.0
Public Member Functions
StepData_EnumTool Class Reference

This class gives a way of conversion between the value of an enumeration and its representation in STEP An enumeration corresponds to an integer with reserved values, which begin to 0 In STEP, it is represented by a name in capital letter and limited by two dots, e.g. .UNKNOWN. More...

#include <StepData_EnumTool.hxx>

Public Member Functions

 StepData_EnumTool (const Standard_CString e0="", const Standard_CString e1="", const Standard_CString e2="", const Standard_CString e3="", const Standard_CString e4="", const Standard_CString e5="", const Standard_CString e6="", const Standard_CString e7="", const Standard_CString e8="", const Standard_CString e9="", const Standard_CString e10="", const Standard_CString e11="", const Standard_CString e12="", const Standard_CString e13="", const Standard_CString e14="", const Standard_CString e15="", const Standard_CString e16="", const Standard_CString e17="", const Standard_CString e18="", const Standard_CString e19="", const Standard_CString e20="", const Standard_CString e21="", const Standard_CString e22="", const Standard_CString e23="", const Standard_CString e24="", const Standard_CString e25="", const Standard_CString e26="", const Standard_CString e27="", const Standard_CString e28="", const Standard_CString e29="", const Standard_CString e30="", const Standard_CString e31="", const Standard_CString e32="", const Standard_CString e33="", const Standard_CString e34="", const Standard_CString e35="", const Standard_CString e36="", const Standard_CString e37="", const Standard_CString e38="", const Standard_CString e39="")
 Creates an EnumTool with definitions given by e0 .. e<max> Each definition string can bring one term, or several separated by blanks. Each term corresponds to one value of the enumeration, if dots are not presents they are added. More...
 
void AddDefinition (const Standard_CString term)
 Processes a definition, splits it according blanks if any empty definitions are ignored A null definition can be input by given "$" :the corresponding position is attached to "null/undefined" value (as one particular item of the enumeration list) See also IsSet. More...
 
Standard_Boolean IsSet () const
 Returns True if at least one definition has been entered after creation time (i.e. by AddDefinition only) More...
 
Standard_Integer MaxValue () const
 Returns the maximum integer for a suitable value Remark : while values begin at zero, MaxValue is the count of recorded values minus one. More...
 
void Optional (const Standard_Boolean mode)
 Sets or Unsets the EnumTool to accept undefined value (for optional field). Ignored if no null value is defined (by "$") Can be changed during execution (to read each field), Default is True (if a null value is defined) More...
 
Standard_Integer NullValue () const
 Returns the value attached to "null/undefined value" If none is specified or if Optional has been set to False, returns -1 Null Value has been specified by definition "$". More...
 
const TCollection_AsciiStringText (const Standard_Integer num) const
 Returns the text which corresponds to a given numeric value It is limited by dots If num is out of range, returns an empty string. More...
 
Standard_Integer Value (const Standard_CString txt) const
 Returns the numeric value found for a text The text must be in capitals and limited by dots A non-suitable text gives a negative value to be returned. More...
 
Standard_Integer Value (const TCollection_AsciiString &txt) const
 Same as above but works on an AsciiString. More...
 

Detailed Description

This class gives a way of conversion between the value of an enumeration and its representation in STEP An enumeration corresponds to an integer with reserved values, which begin to 0 In STEP, it is represented by a name in capital letter and limited by two dots, e.g. .UNKNOWN.

EnumTool works with integers, it is just required to cast between an integer and an enumeration of required type.

Its definition is intended to allow static creation in once, without having to recreate once for each use.

It is possible to define subclasses on it, which directly give the good list of definition texts, and accepts a enumeration of the good type instead of an integer

Constructor & Destructor Documentation

◆ StepData_EnumTool()

StepData_EnumTool::StepData_EnumTool ( const Standard_CString  e0 = "",
const Standard_CString  e1 = "",
const Standard_CString  e2 = "",
const Standard_CString  e3 = "",
const Standard_CString  e4 = "",
const Standard_CString  e5 = "",
const Standard_CString  e6 = "",
const Standard_CString  e7 = "",
const Standard_CString  e8 = "",
const Standard_CString  e9 = "",
const Standard_CString  e10 = "",
const Standard_CString  e11 = "",
const Standard_CString  e12 = "",
const Standard_CString  e13 = "",
const Standard_CString  e14 = "",
const Standard_CString  e15 = "",
const Standard_CString  e16 = "",
const Standard_CString  e17 = "",
const Standard_CString  e18 = "",
const Standard_CString  e19 = "",
const Standard_CString  e20 = "",
const Standard_CString  e21 = "",
const Standard_CString  e22 = "",
const Standard_CString  e23 = "",
const Standard_CString  e24 = "",
const Standard_CString  e25 = "",
const Standard_CString  e26 = "",
const Standard_CString  e27 = "",
const Standard_CString  e28 = "",
const Standard_CString  e29 = "",
const Standard_CString  e30 = "",
const Standard_CString  e31 = "",
const Standard_CString  e32 = "",
const Standard_CString  e33 = "",
const Standard_CString  e34 = "",
const Standard_CString  e35 = "",
const Standard_CString  e36 = "",
const Standard_CString  e37 = "",
const Standard_CString  e38 = "",
const Standard_CString  e39 = "" 
)

Creates an EnumTool with definitions given by e0 .. e<max> Each definition string can bring one term, or several separated by blanks. Each term corresponds to one value of the enumeration, if dots are not presents they are added.

Such a static constructor allows to build a static description as : static StepData_EnumTool myenumtool("e0","e1"...); then use it without having to initialise it

A null definition can be input by given "$" :the corresponding position is attached to "null/undefined" value (as one particular item of the enumeration list)

Member Function Documentation

◆ AddDefinition()

void StepData_EnumTool::AddDefinition ( const Standard_CString  term)

Processes a definition, splits it according blanks if any empty definitions are ignored A null definition can be input by given "$" :the corresponding position is attached to "null/undefined" value (as one particular item of the enumeration list) See also IsSet.

◆ IsSet()

Standard_Boolean StepData_EnumTool::IsSet ( ) const

Returns True if at least one definition has been entered after creation time (i.e. by AddDefinition only)

This allows to build a static description by a first pass : static StepData_EnumTool myenumtool("e0" ...); ... if (!myenumtool.IsSet()) { for further inits myenumtool.AddDefinition("e21"); ... }

◆ MaxValue()

Standard_Integer StepData_EnumTool::MaxValue ( ) const

Returns the maximum integer for a suitable value Remark : while values begin at zero, MaxValue is the count of recorded values minus one.

◆ NullValue()

Standard_Integer StepData_EnumTool::NullValue ( ) const

Returns the value attached to "null/undefined value" If none is specified or if Optional has been set to False, returns -1 Null Value has been specified by definition "$".

◆ Optional()

void StepData_EnumTool::Optional ( const Standard_Boolean  mode)

Sets or Unsets the EnumTool to accept undefined value (for optional field). Ignored if no null value is defined (by "$") Can be changed during execution (to read each field), Default is True (if a null value is defined)

◆ Text()

const TCollection_AsciiString& StepData_EnumTool::Text ( const Standard_Integer  num) const

Returns the text which corresponds to a given numeric value It is limited by dots If num is out of range, returns an empty string.

◆ Value() [1/2]

Standard_Integer StepData_EnumTool::Value ( const Standard_CString  txt) const

Returns the numeric value found for a text The text must be in capitals and limited by dots A non-suitable text gives a negative value to be returned.

◆ Value() [2/2]

Standard_Integer StepData_EnumTool::Value ( const TCollection_AsciiString txt) const

Same as above but works on an AsciiString.


The documentation for this class was generated from the following file: