Open CASCADE Technology
7.0.0
|
A Profile gives access to a set of options : More...
#include <MoniTool_Profile.hxx>
Public Member Functions | |
MoniTool_Profile () | |
Creates an empty Profile, with an empty Current Configuration (named ".") More... | |
void | AddOption (const Handle< MoniTool_Option > &option, const Standard_CString name="") |
Adds an Option, with a Name, by default takes the Name of the Option. More... | |
Handle< MoniTool_Option > | Option (const Standard_CString name) const |
Returns an Option from its Name. Null Handle if unknown. More... | |
Handle< TColStd_HSequenceOfAsciiString > | OptionList () const |
Returns the list of Option Names. More... | |
Handle< TColStd_HSequenceOfAsciiString > | TypedValueList () const |
Returns the list of Option Names which are defined on a TypedValue/Static, i.e. for Basic Type. More... | |
void | NewConf (const Standard_CString confname) |
Adds a new Configuration, yet empty, then filled by AddSwitch If <confname> already existed, it is replaced from scratch While AddConf creates new Conf only if it does not yet exist. More... | |
void | AddConf (const Standard_CString confname) |
Adds a new Configuration, yet empty, then filled by AddSwitch If <confname> already existed, it is kept as it is While NewConf restrts from scratch anyway. More... | |
Standard_Boolean | HasConf (const Standard_CString confname) const |
Tells if <confname> is known as a Configuration. More... | |
Handle< TColStd_HSequenceOfAsciiString > | ConfList () const |
Returns the list of Configuration Names, including Current ".". More... | |
Standard_Boolean | ClearConf (const Standard_CString confname) |
Clears a configuration (does not remove it) A cleared configuration has no effect, it can be reloaded. More... | |
Standard_Boolean | AddFromOtherConf (const Standard_CString confname, const Standard_CString otherconf) |
Adds the definitions from the configuration <otherconf> to those of <confname> Returns True if done, False if confname or otherconf are unknown. More... | |
Standard_Boolean | SetFromCurrent (const Standard_CString confname) |
Sets the definitions of a configuration from the actual state (current configuration plus current state of options for those which are not recorded in current conf) More... | |
Standard_Boolean | AddSwitch (const Standard_CString confname, const Standard_CString optname, const Standard_CString casename="") |
Adds to the Configuration <confname>, for the option <optname> the command to switch it to <casename> If <casename> is not given, records the actual current CaseName of this Option Returns True if done, False if <confname> or <optname> is unknown, or <casename> not allowed for <optname> More... | |
Standard_Boolean | RemoveSwitch (const Standard_CString confname, const Standard_CString optname) |
Removes from the Configuration <confname>, the switch for the option <optname>. Hence, it will consider the basic default switch for this option Returns True if done or switch was not recorded, False if <confname> or <optname> is unknown. More... | |
void | SwitchList (const Standard_CString confname, Handle< TColStd_HSequenceOfAsciiString > &optlist, Handle< TColStd_HSequenceOfAsciiString > &caselist) const |
Returns the list of switches properly concerned by a config : two lists in parallel, <optlist> lists the names of options and for each one, <caselist> gives the case for this config. More... | |
Standard_Boolean | SetCurrent (const Standard_CString confname) |
Copies (Cumulates) the definition of <confname> to current Records the current name as the last current setting. More... | |
void | RecordCurrent () |
Records the switches of current configuration in the options themselves. More... | |
const TCollection_AsciiString & | Current () const |
Returns the name of last current configuration. More... | |
TCollection_AsciiString | CaseName (const Standard_CString optname, const Standard_Boolean proper=Standard_False) const |
Returns the selected case name of option <optname> in current configuration Empty String if <optname> unknown. More... | |
Handle< Standard_Transient > | CaseValue (const Standard_CString optname) const |
Returns the Value of the switch selected for option <optname> in current configuration Null Handle if <optname> unknown To be down-casted as needed before use. More... | |
Standard_Boolean | Value (const Standard_CString optname, Handle< Standard_Transient > &val) const |
Returns the Value of the switch selected for option <optname> in current configuration Returns True if done, False + Null Handle if <optname> unknown This way of returning a Transient, bound with the Type Control avoids DownCast and ensures the value is directly usable. More... | |
void | SetTypedValues (const Standard_Boolean proper=Standard_False, const Standard_CString name="") const |
For the Options which are defined with a TypedValue/Static, takes the value defined in current configuration, and sets the TypedValue with it. More... | |
void | SetFast (const Standard_CString confname="") |
Recomputes fast access from the definition of a configuration By default, the current one Else, a configuration identified by its name. More... | |
void | ClearFast () |
Clears definitions of fast access. More... | |
Standard_Boolean | FastValue (const Standard_CString optname, Handle< Standard_Transient > &val) const |
Gets the value corresponding to Option <optname>, as fast If not defined as fast, check "normal" access by calling Value Returns True if OK (either Fast or normal), False if not found (if not found, <val> is returned Null Handle) More... | |
Public Member Functions inherited from MMgt_TShared | |
virtual void | Delete () const override |
Memory deallocator for transient classes. More... | |
Public Member Functions inherited from Standard_Transient | |
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 opencascade::handle< Standard_Type > & | DynamicType () const |
Returns a type descriptor about this object. More... | |
Standard_Boolean | IsInstance (const opencascade::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 opencascade::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... | |
Standard_Transient * | This () const |
Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More... | |
Standard_Integer | GetRefCount () const |
Get the reference counter of this object. More... | |
void | IncrementRefCounter () const |
Increments the reference counter of this object. More... | |
Standard_Integer | DecrementRefCounter () const |
Decrements the reference counter of this object; returns the decremented value. More... | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
typedef void | base_type |
Returns a type descriptor about this object. More... | |
Static Public Member Functions inherited from Standard_Transient | |
static const char * | get_type_name () |
Returns a type descriptor about this object. More... | |
static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
Returns type descriptor of Standard_Transient class. More... | |
A Profile gives access to a set of options :
It may also bring a "fast" access to values, which has been formerly computed from current configuration or another given one. But its up-to-date status regarding existing configurations is not checked : it may be recomputed or cleared at any time. If not set, the current configuration is then taken
MoniTool_Profile::MoniTool_Profile | ( | ) |
Creates an empty Profile, with an empty Current Configuration (named ".")
void MoniTool_Profile::AddConf | ( | const Standard_CString | confname | ) |
Adds a new Configuration, yet empty, then filled by AddSwitch If <confname> already existed, it is kept as it is While NewConf restrts from scratch anyway.
Remark : the Current Configuration "." may not be changed
Standard_Boolean MoniTool_Profile::AddFromOtherConf | ( | const Standard_CString | confname, |
const Standard_CString | otherconf | ||
) |
Adds the definitions from the configuration <otherconf> to those of <confname> Returns True if done, False if confname or otherconf are unknown.
void MoniTool_Profile::AddOption | ( | const Handle< MoniTool_Option > & | option, |
const Standard_CString | name = "" |
||
) |
Adds an Option, with a Name, by default takes the Name of the Option.
Standard_Boolean MoniTool_Profile::AddSwitch | ( | const Standard_CString | confname, |
const Standard_CString | optname, | ||
const Standard_CString | casename = "" |
||
) |
Adds to the Configuration <confname>, for the option <optname> the command to switch it to <casename> If <casename> is not given, records the actual current CaseName of this Option Returns True if done, False if <confname> or <optname> is unknown, or <casename> not allowed for <optname>
TCollection_AsciiString MoniTool_Profile::CaseName | ( | const Standard_CString | optname, |
const Standard_Boolean | proper = Standard_False |
||
) | const |
Returns the selected case name of option <optname> in current configuration Empty String if <optname> unknown.
If <proper> is False (D), if <optname> is not recorded in the current configuration, the own current name of the option itself is taken Else, an empty string is returned
Handle< Standard_Transient > MoniTool_Profile::CaseValue | ( | const Standard_CString | optname | ) | const |
Returns the Value of the switch selected for option <optname> in current configuration Null Handle if <optname> unknown To be down-casted as needed before use.
Standard_Boolean MoniTool_Profile::ClearConf | ( | const Standard_CString | confname | ) |
Clears a configuration (does not remove it) A cleared configuration has no effect, it can be reloaded.
void MoniTool_Profile::ClearFast | ( | ) |
Clears definitions of fast access.
Handle< TColStd_HSequenceOfAsciiString > MoniTool_Profile::ConfList | ( | ) | const |
Returns the list of Configuration Names, including Current ".".
const TCollection_AsciiString& MoniTool_Profile::Current | ( | ) | const |
Returns the name of last current configuration.
Standard_Boolean MoniTool_Profile::FastValue | ( | const Standard_CString | optname, |
Handle< Standard_Transient > & | val | ||
) | const |
Gets the value corresponding to Option <optname>, as fast If not defined as fast, check "normal" access by calling Value Returns True if OK (either Fast or normal), False if not found (if not found, <val> is returned Null Handle)
Standard_Boolean MoniTool_Profile::HasConf | ( | const Standard_CString | confname | ) | const |
Tells if <confname> is known as a Configuration.
void MoniTool_Profile::NewConf | ( | const Standard_CString | confname | ) |
Adds a new Configuration, yet empty, then filled by AddSwitch If <confname> already existed, it is replaced from scratch While AddConf creates new Conf only if it does not yet exist.
Remark : the Current Configuration "." may not be changed
Handle< MoniTool_Option > MoniTool_Profile::Option | ( | const Standard_CString | name | ) | const |
Returns an Option from its Name. Null Handle if unknown.
Handle< TColStd_HSequenceOfAsciiString > MoniTool_Profile::OptionList | ( | ) | const |
Returns the list of Option Names.
void MoniTool_Profile::RecordCurrent | ( | ) |
Records the switches of current configuration in the options themselves.
Standard_Boolean MoniTool_Profile::RemoveSwitch | ( | const Standard_CString | confname, |
const Standard_CString | optname | ||
) |
Removes from the Configuration <confname>, the switch for the option <optname>. Hence, it will consider the basic default switch for this option Returns True if done or switch was not recorded, False if <confname> or <optname> is unknown.
Standard_Boolean MoniTool_Profile::SetCurrent | ( | const Standard_CString | confname | ) |
Copies (Cumulates) the definition of <confname> to current Records the current name as the last current setting.
Returns True if done, False (and does nothing> if <confname> is not recorded as a Configuration If no SetCurrent has been called, the last added one is taken
Remark : SetCurrent is for the Profile : the individual options are not switched themselves, they are only queried To switch the options themselves, see below RecordCurrent
Remark : for Options which are listed in the Profile but not in the current Configuration, their current switch is taken
void MoniTool_Profile::SetFast | ( | const Standard_CString | confname = "" | ) |
Recomputes fast access from the definition of a configuration By default, the current one Else, a configuration identified by its name.
Standard_Boolean MoniTool_Profile::SetFromCurrent | ( | const Standard_CString | confname | ) |
Sets the definitions of a configuration from the actual state (current configuration plus current state of options for those which are not recorded in current conf)
void MoniTool_Profile::SetTypedValues | ( | const Standard_Boolean | proper = Standard_False , |
const Standard_CString | name = "" |
||
) | const |
For the Options which are defined with a TypedValue/Static, takes the value defined in current configuration, and sets the TypedValue with it.
If <proper> is False (D), takes the current value, whatever it is properly recorded in current configuration or not If <proper> is True, sets the value only if it is properly recorded in the current configuration
By default, considers all the Options with a TypedValue If <name> is given, considers the Options of which the name begins by <name>
void MoniTool_Profile::SwitchList | ( | const Standard_CString | confname, |
Handle< TColStd_HSequenceOfAsciiString > & | optlist, | ||
Handle< TColStd_HSequenceOfAsciiString > & | caselist | ||
) | const |
Returns the list of switches properly concerned by a config : two lists in parallel, <optlist> lists the names of options and for each one, <caselist> gives the case for this config.
Handle< TColStd_HSequenceOfAsciiString > MoniTool_Profile::TypedValueList | ( | ) | const |
Returns the list of Option Names which are defined on a TypedValue/Static, i.e. for Basic Type.
Standard_Boolean MoniTool_Profile::Value | ( | const Standard_CString | optname, |
Handle< Standard_Transient > & | val | ||
) | const |
Returns the Value of the switch selected for option <optname> in current configuration Returns True if done, False + Null Handle if <optname> unknown This way of returning a Transient, bound with the Type Control avoids DownCast and ensures the value is directly usable.