|
Mantid
|
A concrete property based on user options of a finite list of strings. More...
#include <EnumeratedStringProperty.h>
Public Member Functions | |
| std::vector< std::string > | allowedValues () const override |
| Returns the set of valid values for this property, if such a set exists. | |
| EnumeratedStringProperty * | clone () const override |
| Virtual copy constructor. | |
| EnumeratedStringProperty (EnumeratedStringProperty const &right) | |
| Copy Constructor. | |
| EnumeratedStringProperty (std::string const &name, ENUMSTRING const &defaultValue=static_cast< E >(0), Direction::Type const direction=Direction::Input) | |
| Constructor. | |
| std::string | getDefault () const override |
| Get the value the property was initialised with -its default value. | |
| bool | isDefault () const override |
| Indicates if the property's value is the same as it was when it was set N.B. | |
| std::string | isValid () const override |
| If the value has been set, then it is valid. | |
| operator E () const | |
| operator ENUMSTRING () const | |
| Allows you to get the value of the property simply by typing its name. | |
| operator std::string () const | |
| bool | operator!= (EnumeratedStringProperty const &rhs) const |
| Deep comparison (not equal). | |
| ENUMSTRING | operator() () const |
| Allows you to get the value of the property simply by typing its name. | |
| EnumeratedStringProperty & | operator+= (Property const *right) override |
| Add the value of another property. | |
| EnumeratedStringProperty const & | operator= (E const value) |
| Assignment operator. | |
| EnumeratedStringProperty & | operator= (EnumeratedStringProperty const &right) |
| Assignment operator. | |
| EnumeratedStringProperty const & | operator= (ENUMSTRING const &value) |
| Assignment operator. | |
| EnumeratedStringProperty const & | operator= (std::string const &value) |
| Assignment operator. | |
| bool | operator== (EnumeratedStringProperty const &rhs) const |
| Deep comparison. | |
| void | saveProperty (Nexus::File *file) override |
| std::string | setDataItem (const std::shared_ptr< DataItem > &data) override |
| Set a property value via a DataItem. | |
| std::string | setValue (E const value) |
| Set the value of the property from a string representation. | |
| std::string | setValue (ENUMSTRING const &value) |
| Set the value of the property from a string representation. | |
| std::string | setValue (std::string const &value) override |
| Set the value of the property from a string representation. | |
| std::string | setValueFromJson (const Json::Value &value) override |
| Set the value of the property from a Json representation. | |
| int | size () const override |
| Get the size of the property. | |
| std::string | value () const override |
| Get the value of the property as a string. | |
| Json::Value | valueAsJson () const override |
| Attempt to construct a Json::Value object from the plain value. | |
| std::string | valueAsPrettyStr (size_t const maxLength=0, bool const collapseLists=true) const override |
| Get the value of the property as a more prettier string. | |
Public Member Functions inherited from Mantid::Kernel::Property | |
| bool | autoTrim () const |
| Returns if the property is set to automatically trim string unput values of whitespace. | |
| void | clearSettings () |
| Deletes the PropertySettings object contained. | |
| virtual const PropertyHistory | createHistory () const |
| Create a PropertyHistory object representing the current state of the Property. | |
| void | createTemporaryValue () |
| Create a temporary value for this property. | |
| unsigned int | direction () const |
| returns the direction of the property | |
| bool | disableReplaceWSButton () const |
| Returns if the property is set to disable the creation of the "Replace Workspace" button. | |
| const std::string & | documentation () const |
| Get the property's documentation string. | |
| const std::string & | getGroup () |
| virtual size_t | getMemorySize () const |
| IPropertySettings * | getSettings () |
| const IPropertySettings * | getSettings () const |
| bool | hasTemporaryValue () const |
| Property is using a temporary value for this property. | |
| bool | isDynamicDefault () const |
| Returns a flag indicating that the property's value has been set programmatically, for example, if the property has a default value which depends on the value of an upstream property. | |
| virtual bool | isMultipleSelectionAllowed () |
| Is Multiple Selection Allowed. | |
| virtual bool | isValueSerializable () const |
| Whether the string returned by value() can be used for serialization. | |
| virtual Property & | merge (Property *) |
| Just returns the property (*this) unless overridden. | |
| const std::string & | name () const |
| Get the property's name. | |
| bool | remember () const |
| Whether to save input values. | |
| void | setAutoTrim (const bool &setting) |
| Sets if the property is set to automatically trim string unput values of whitespace. | |
| void | setDisableReplaceWSButton (const bool &disable) |
| Sets the property to disable the creation of the "Replace Workspace" button. | |
| void | setDocumentation (const std::string &documentation) |
| Sets the user level description of the property. | |
| void | setGroup (const std::string &group) |
| Set the group this property belongs to. | |
| void | setIsDynamicDefault (const bool &flag) |
| Set or clear the flag indicating whether or not the property's value has been set programmatically. | |
| void | setName (const std::string &name) |
| Set the property's name. | |
| void | setRemember (bool) |
| Set wheter to remeber this property input. | |
| void | setSettings (std::unique_ptr< IPropertySettings > settings) |
| Set the PropertySettings object. | |
| virtual void | setUnits (const std::string &unit) |
| Sets the units of the property, as a string. | |
| const std::string | type () const |
| Returns the type of the property as a string. | |
| const std::type_info * | type_info () const |
| Get the property type_info. | |
| virtual const std::string & | units () const |
| Returns the units of the property, if any, as a string. | |
| virtual | ~Property () |
| Virtual destructor. | |
Protected Attributes | |
| ENUMSTRING | m_initialValue |
| the property's default value which is also its initial value | |
| ENUMSTRING | m_value |
| The value of the property. | |
Protected Attributes inherited from Mantid::Kernel::Property | |
| std::string | m_name |
| The name of the property. | |
Private Types | |
| using | ENUMSTRING = EnumeratedString< E, names > |
Private Member Functions | |
| template<typename U > | |
| std::string | setTypedValue (U const &value, std::false_type const &) |
| Helper function for setValue(DataItem_sptr). | |
| template<typename U > | |
| std::string | setTypedValue (U const &value, std::true_type const &) |
| Helper function for setValue(DataItem_sptr). | |
| std::string | setValueFromProperty (Property const &right) override |
| Set the value of the property via a reference to another property. | |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::Kernel::Property | |
| Property (const Property &right) | |
| Copy constructor. | |
| Property (std::string name, const std::type_info &type, const unsigned int &direction=Direction::Input) | |
| Constructor. | |
A concrete property based on user options of a finite list of strings.
Allows for easy comparison by binding the string list to an enum.
Definition at line 23 of file EnumeratedStringProperty.h.
|
private |
Definition at line 25 of file EnumeratedStringProperty.h.
| Mantid::Kernel::EnumeratedStringProperty< E, names >::EnumeratedStringProperty | ( | std::string const & | name, |
| ENUMSTRING const & | defaultValue = static_cast<E>(0), |
||
| Direction::Type const | direction = Direction::Input |
||
| ) |
Constructor.
| name | :: The name to assign to the property |
| defaultValue | :: Is stored initial default value of the property |
| direction | :: Whether this is a Direction::Input, Direction::Output or Direction::InOut (Input & Output) property |
Definition at line 30 of file EnumeratedStringProperty.hxx.
| Mantid::Kernel::EnumeratedStringProperty< E, names >::EnumeratedStringProperty | ( | EnumeratedStringProperty< E, names > const & | right | ) |
Copy Constructor.
| right | :: a copy |
Definition at line 38 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Returns the set of valid values for this property, if such a set exists.
If not, it returns an empty vector.
Reimplemented from Mantid::Kernel::Property.
Definition at line 169 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Virtual copy constructor.
Implements Mantid::Kernel::Property.
Definition at line 45 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Get the value the property was initialised with -its default value.
Implements Mantid::Kernel::Property.
Definition at line 128 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Indicates if the property's value is the same as it was when it was set N.B.
Uses an unsafe comparison in the case of doubles, consider overriding if the value is a pointer or floating point type
Implements Mantid::Kernel::Property.
Definition at line 159 of file EnumeratedStringProperty.hxx.
References m_value.
|
overridevirtual |
If the value has been set, then it is valid.
Reimplemented from Mantid::Kernel::Property.
Definition at line 145 of file EnumeratedStringProperty.hxx.
References m_value.
|
inline |
Definition at line 50 of file EnumeratedStringProperty.h.
References Mantid::Kernel::EnumeratedStringProperty< E, names >::m_value.
|
inline |
Allows you to get the value of the property simply by typing its name.
Means you can use an expression like: int i = myProperty;
Definition at line 49 of file EnumeratedStringProperty.h.
References Mantid::Kernel::EnumeratedStringProperty< E, names >::m_value.
|
inline |
Definition at line 51 of file EnumeratedStringProperty.h.
References Mantid::Kernel::EnumeratedStringProperty< E, names >::m_value.
| bool Mantid::Kernel::EnumeratedStringProperty< E, names >::operator!= | ( | EnumeratedStringProperty< E, names > const & | rhs | ) | const |
Deep comparison (not equal).
| rhs | The other property to compare to. |
Definition at line 114 of file EnumeratedStringProperty.hxx.
References rhs.
| EnumeratedString< E, names > Mantid::Kernel::EnumeratedStringProperty< E, names >::operator() | ( | ) | const |
Allows you to get the value of the property simply by typing its name.
Means you can use an expression like: int i = myProperty();
Definition at line 137 of file EnumeratedStringProperty.hxx.
References m_value.
|
overridevirtual |
Add the value of another property.
| right | the property to add |
Implements Mantid::Kernel::Property.
Definition at line 302 of file EnumeratedStringProperty.hxx.
References right.
| EnumeratedStringProperty< E, names > const & Mantid::Kernel::EnumeratedStringProperty< E, names >::operator= | ( | E const | value | ) |
Assignment operator.
Allows assignment of a new value to the property by writing, e.g., myProperty = 3;
| value | :: The new value to assign to the property |
Definition at line 260 of file EnumeratedStringProperty.hxx.
| EnumeratedStringProperty< E, names > & Mantid::Kernel::EnumeratedStringProperty< E, names >::operator= | ( | EnumeratedStringProperty< E, names > const & | right | ) |
Assignment operator.
Copy assignment operator assigns only the value and the validator not the name, default (initial) value, etc. Allows assignment of a new value to the property by writing, e.g., myProperty = 3;
| right | :: The new value to assign to the property |
Definition at line 59 of file EnumeratedStringProperty.hxx.
References m_value, Mantid::Kernel::EnumeratedStringProperty< E, names >::m_value, and right.
| EnumeratedStringProperty< E, names > const & Mantid::Kernel::EnumeratedStringProperty< E, names >::operator= | ( | ENUMSTRING const & | value | ) |
Assignment operator.
Allows assignment of a new value to the property by writing, e.g., myProperty = 3;
| value | :: The new value to assign to the property |
Definition at line 287 of file EnumeratedStringProperty.hxx.
| EnumeratedStringProperty< E, names > const & Mantid::Kernel::EnumeratedStringProperty< E, names >::operator= | ( | std::string const & | value | ) |
Assignment operator.
Allows assignment of a new value to the property by writing, e.g., myProperty = 3;
| value | :: The new value to assign to the property |
Definition at line 273 of file EnumeratedStringProperty.hxx.
| bool Mantid::Kernel::EnumeratedStringProperty< E, names >::operator== | ( | EnumeratedStringProperty< E, names > const & | rhs | ) | const |
Deep comparison.
| rhs | The other property to compare to. |
Definition at line 102 of file EnumeratedStringProperty.hxx.
References m_value, name, Mantid::Kernel::Property::name(), and rhs.
|
overridevirtual |
Reimplemented from Mantid::Kernel::Property.
Definition at line 310 of file EnumeratedStringProperty.hxx.
References name.
|
overridevirtual |
Set a property value via a DataItem.
| data | :: A shared pointer to a data item |
Implements Mantid::Kernel::Property.
Definition at line 245 of file EnumeratedStringProperty.hxx.
|
private |
Helper function for setValue(DataItem_sptr).
Uses boost type traits to ensure it is only used if U is NOT a type that is convertible to std::shared_ptr<DataItem>
| value | :: A object of type convertible to std::shared_ptr<DataItem> |
Definition at line 368 of file EnumeratedStringProperty.hxx.
References name.
|
private |
Helper function for setValue(DataItem_sptr).
Uses boost type traits to ensure it is only used if U is a type that is convertible to std::shared_ptr<DataItem>
| value | :: A object of type convertible to std::shared_ptr<DataItem> |
Definition at line 349 of file EnumeratedStringProperty.hxx.
| std::string Mantid::Kernel::EnumeratedStringProperty< E, names >::setValue | ( | E const | value | ) |
Set the value of the property from a string representation.
| value | :: The value to assign to the property |
Definition at line 183 of file EnumeratedStringProperty.hxx.
| std::string Mantid::Kernel::EnumeratedStringProperty< E, names >::setValue | ( | ENUMSTRING const & | value | ) |
Set the value of the property from a string representation.
| value | :: The value to assign to the property |
Definition at line 213 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Set the value of the property from a string representation.
| value | :: The value to assign to the property |
Implements Mantid::Kernel::Property.
Definition at line 194 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Set the value of the property from a Json representation.
| value | :: The value to assign to the property |
Implements Mantid::Kernel::Property.
Definition at line 225 of file EnumeratedStringProperty.hxx.
References value.
|
overrideprivatevirtual |
Set the value of the property via a reference to another property.
If the value is unacceptable the value is not changed but a string is returned. The value is only accepted if the other property has the same type as this
| right | :: A reference to a property. |
Implements Mantid::Kernel::Property.
Definition at line 330 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Get the size of the property.
Reimplemented from Mantid::Kernel::Property.
Definition at line 120 of file EnumeratedStringProperty.hxx.
|
overridevirtual |
Get the value of the property as a string.
Implements Mantid::Kernel::Property.
Definition at line 74 of file EnumeratedStringProperty.hxx.
References m_value.
|
overridevirtual |
Attempt to construct a Json::Value object from the plain value.
Implements Mantid::Kernel::Property.
Definition at line 92 of file EnumeratedStringProperty.hxx.
References Mantid::Kernel::encodeAsJson().
|
overridevirtual |
Get the value of the property as a more prettier string.
Reimplemented from Mantid::Kernel::Property.
Definition at line 82 of file EnumeratedStringProperty.hxx.
References m_value, and Mantid::Kernel::toPrettyString().
|
protected |
the property's default value which is also its initial value
Definition at line 76 of file EnumeratedStringProperty.h.
|
protected |
The value of the property.
Definition at line 74 of file EnumeratedStringProperty.h.
Referenced by Mantid::Kernel::EnumeratedStringProperty< E, names >::operator E(), Mantid::Kernel::EnumeratedStringProperty< E, names >::operator ENUMSTRING(), Mantid::Kernel::EnumeratedStringProperty< E, names >::operator std::string(), and Mantid::Kernel::EnumeratedStringProperty< E, names >::operator=().