Open CASCADE Technology
6.9.1
|
An Option gives a way of recording an enumerated list of instances of a given class, each instance being identified by a case name. More...
#include <MoniTool_Option.hxx>
Public Member Functions | |
MoniTool_Option (const Handle< Standard_Type > &atype, const Standard_CString aname) | |
Creates an Option from scratch, with a Type and a Name. More... | |
MoniTool_Option (const Handle< MoniTool_TypedValue > &aval, const Standard_CString aname="") | |
Creates an Option for a TypedValue (for basic, non-cdl-typed, value : integer, real, string ...) If <name> is not given, the name of the TypedValue is taken Remark that Type is then enforced to TCollection_HAsciiString. More... | |
MoniTool_Option (const Handle< MoniTool_Option > &other, const Standard_CString aname="") | |
Creates an Option from another one, the name can be redefined The Type remains the same. The list of Items, too, it can also be later duplicated by call to Duplicate. More... | |
Standard_Boolean | Add (const Standard_CString name, const Handle< Standard_Transient > &val) |
Adds an item : value and name (replaces it if name is already recorded) Returns True when done, False if <val> is not Kind of the definition Type For a TypedValue, val must be a HAsciiString, its content must satisfy the definition of the TypedValue. More... | |
Standard_Boolean | AddBasic (const Standard_CString name, const Standard_CString val="") |
Short-cut to add an item for a TypedValue (basic type) : name is the name of the case, val is its value as a CString If val is not provided, val = name is assumed Returns True when done, False if this Option is not for a TypedValue or if the new value does not satisfy the definition of the TypedValue. More... | |
void | Duplicate () |
Duplicates the list of items It starts with the same definitions as before Duplicate, but it is not longer shared with other options. More... | |
const TCollection_AsciiString & | Name () const |
Returns the Name of the Option. More... | |
Handle< Standard_Type > | Type () const |
Returns the Type of the Option. More... | |
Handle< MoniTool_TypedValue > | TypedValue () const |
Returns the TypedValue of the Option, or a Null Handle. More... | |
Standard_Boolean | Item (const Standard_CString name, Handle< Standard_Transient > &val) const |
Gives the value bound with a name, in val Returns True if <name> is found, False else This way of returning a Transient, bound with the Type Control avoids DownCast and ensures the value is directly usable. More... | |
Handle< TColStd_HSequenceOfAsciiString > | ItemList () const |
Returns the list of available item names. More... | |
Handle< TColStd_HSequenceOfAsciiString > | Aliases (const Standard_CString name, const Standard_Boolean exact=Standard_True) const |
Returns the list of cases, other than <name>, which bring the same value as <name> Empty list (not a Null Handle) if no alias, or <name> unknown if <exact> is True (D), exact name is required, no completion if <exact> is False and <name> is not complete, but addresses only one item, completion is done and the list includes the complete name. More... | |
Standard_Boolean | Switch (const Standard_CString name) |
Commands the Option to switch on an item name Returns True when done, False if <name> is not recorded (in that case, former switch remains unchanged) If no switch has been called, it is active on the last added items. More... | |
const TCollection_AsciiString & | CaseName () const |
Returns the Name of the currently switched item (Case) More... | |
Handle< Standard_Transient > | CaseValue () const |
Returns the Value of the currently switch item To be down-casted as needed before use. More... | |
void | Value (Handle< Standard_Transient > &val) const |
Returns the Value of the currently switch item This way of returning a Transient, bound with the Type Control avoids DownCast and ensures the value is directly usable For a TypedValue, returns the corresponding HAsciiString. More... | |
![]() | |
virtual void | Delete () const |
Memory deallocator for transient classes. More... | |
![]() | |
Standard_Transient () | |
Empty constructor. More... | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. More... | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. More... | |
virtual | ~Standard_Transient () |
Destructor must be virtual. More... | |
virtual const Handle_Standard_Type & | DynamicType () const |
Returns a type information object about this object. More... | |
Standard_Boolean | IsInstance (const Handle_Standard_Type &theType) const |
Returns a true value if this is an instance of Type. More... | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. More... | |
Standard_Boolean | IsKind (const Handle_Standard_Type &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
virtual Handle_Standard_Transient | This () const |
Returns a Handle which references this object. Must never be called to objects created in stack. More... | |
Standard_Integer | GetRefCount () const |
Get the reference counter of this object. More... | |
An Option gives a way of recording an enumerated list of instances of a given class, each instance being identified by a case name.
Also, an Option allows to manage basic types through a Typed Value (which also applies to Static Parameter). It may record an enumerated list of values for a TypedValue or Static Parameter, each of them is recorded as a string (HAsciiString)
An Option is defined by the type of the class to be optioned, or (mutually exclusive) the TypedValue/Static of which values are to be optioned, a specific name, a list of named values. It brings a current case with its name and value It may also have a default case (the first recorded one if not precised)
An Option may be created from another one, by sharing its Type and its list of Items (one per case), with the same name or another one. It may then be duplicated to break this sharing.
MoniTool_Option::MoniTool_Option | ( | const Handle< Standard_Type > & | atype, |
const Standard_CString | aname | ||
) |
Creates an Option from scratch, with a Type and a Name.
MoniTool_Option::MoniTool_Option | ( | const Handle< MoniTool_TypedValue > & | aval, |
const Standard_CString | aname = "" |
||
) |
Creates an Option for a TypedValue (for basic, non-cdl-typed, value : integer, real, string ...) If <name> is not given, the name of the TypedValue is taken Remark that Type is then enforced to TCollection_HAsciiString.
MoniTool_Option::MoniTool_Option | ( | const Handle< MoniTool_Option > & | other, |
const Standard_CString | aname = "" |
||
) |
Creates an Option from another one, the name can be redefined The Type remains the same. The list of Items, too, it can also be later duplicated by call to Duplicate.
Standard_Boolean MoniTool_Option::Add | ( | const Standard_CString | name, |
const Handle< Standard_Transient > & | val | ||
) |
Adds an item : value and name (replaces it if name is already recorded) Returns True when done, False if <val> is not Kind of the definition Type For a TypedValue, val must be a HAsciiString, its content must satisfy the definition of the TypedValue.
Standard_Boolean MoniTool_Option::AddBasic | ( | const Standard_CString | name, |
const Standard_CString | val = "" |
||
) |
Short-cut to add an item for a TypedValue (basic type) : name is the name of the case, val is its value as a CString If val is not provided, val = name is assumed Returns True when done, False if this Option is not for a TypedValue or if the new value does not satisfy the definition of the TypedValue.
Handle< TColStd_HSequenceOfAsciiString > MoniTool_Option::Aliases | ( | const Standard_CString | name, |
const Standard_Boolean | exact = Standard_True |
||
) | const |
Returns the list of cases, other than <name>, which bring the same value as <name> Empty list (not a Null Handle) if no alias, or <name> unknown if <exact> is True (D), exact name is required, no completion if <exact> is False and <name> is not complete, but addresses only one item, completion is done and the list includes the complete name.
const TCollection_AsciiString& MoniTool_Option::CaseName | ( | ) | const |
Returns the Name of the currently switched item (Case)
Handle< Standard_Transient > MoniTool_Option::CaseValue | ( | ) | const |
Returns the Value of the currently switch item To be down-casted as needed before use.
void MoniTool_Option::Duplicate | ( | ) |
Duplicates the list of items It starts with the same definitions as before Duplicate, but it is not longer shared with other options.
Standard_Boolean MoniTool_Option::Item | ( | const Standard_CString | name, |
Handle< Standard_Transient > & | val | ||
) | const |
Gives the value bound with a name, in val Returns True if <name> is found, False else This way of returning a Transient, bound with the Type Control avoids DownCast and ensures the value is directly usable.
Handle< TColStd_HSequenceOfAsciiString > MoniTool_Option::ItemList | ( | ) | const |
Returns the list of available item names.
const TCollection_AsciiString& MoniTool_Option::Name | ( | ) | const |
Returns the Name of the Option.
Standard_Boolean MoniTool_Option::Switch | ( | const Standard_CString | name | ) |
Commands the Option to switch on an item name Returns True when done, False if <name> is not recorded (in that case, former switch remains unchanged) If no switch has been called, it is active on the last added items.
Handle< Standard_Type > MoniTool_Option::Type | ( | ) | const |
Returns the Type of the Option.
Handle< MoniTool_TypedValue > MoniTool_Option::TypedValue | ( | ) | const |
Returns the TypedValue of the Option, or a Null Handle.
void MoniTool_Option::Value | ( | Handle< Standard_Transient > & | val | ) | const |
Returns the Value of the currently switch item This way of returning a Transient, bound with the Type Control avoids DownCast and ensures the value is directly usable For a TypedValue, returns the corresponding HAsciiString.