|
Mantid
|
ListValidator is a validator that requires the value of a property to be one of a defined list of possibilities. More...
#include <ListValidator.h>
Public Member Functions | |
| void | addAllowedValue (const TYPE &value) |
| Add value to the list of allowable values if it's not already there. More... | |
| std::vector< std::string > | allowedValues () const override |
| Returns the set of allowed values currently defined. More... | |
| IValidator_sptr | clone () const override |
| Clone the validator. More... | |
| std::string | getValueForAlias (const std::string &alias) const override |
| Return an allowed value (as a string) given an alias. More... | |
| bool | isMultipleSelectionAllowed () override |
| ListValidator () | |
| Default constructor. Sets up an empty list of valid values. More... | |
| template<typename T > | |
| ListValidator (const T &values, const std::map< std::string, std::string > &aliases=std::map< std::string, std::string >(), const bool allowMultiSelection=false) | |
| Constructor. More... | |
| void | setMultipleSelectionAllowed (const bool isMultiSelectionAllowed) |
Protected Member Functions | |
| std::string | checkValidity (const TYPE &value) const override |
| Checks if the string passed is in the list. More... | |
| bool | isAlias (const std::string &value) const |
| Test if a value is an alias of an alowed value. More... | |
| template<typename T > | |
| bool | isAlias (const T &value) const |
| Test if a value is an alias of an alowed value. More... | |
| bool | isEmpty (const std::string &value) const |
| Is the value considered empty. More... | |
| template<typename T > | |
| bool | isEmpty (const T &value) const |
| Is the value considered empty. More... | |
Protected Attributes | |
| std::map< std::string, std::string > | m_aliases |
| The optional aliases for the allowed values. More... | |
| std::vector< TYPE > | m_allowedValues |
| The set of valid values. More... | |
| bool | m_allowMultiSelection |
| if the validator should allow multiple selection More... | |
ListValidator is a validator that requires the value of a property to be one of a defined list of possibilities.
The default type is std::string
Definition at line 29 of file ListValidator.h.
|
inline |
Default constructor. Sets up an empty list of valid values.
Definition at line 32 of file ListValidator.h.
|
inlineexplicit |
Constructor.
| values | :: An iterable type of the valid values |
| aliases | :: Optional aliases for the valid values. |
| allowMultiSelection | :: True if the list allows multi selection |
Definition at line 40 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_aliases, and Mantid::Kernel::ListValidator< TYPE >::m_allowMultiSelection.
|
inline |
Add value to the list of allowable values if it's not already there.
| value | :: A value of the templated type |
Definition at line 76 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_allowedValues, and value.
|
inlineoverride |
Returns the set of allowed values currently defined.
The interface requires strings
Definition at line 61 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_allowedValues.
|
inlineoverrideprotected |
Checks if the string passed is in the list.
| value | :: The value to test |
Definition at line 111 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::isAlias(), Mantid::Kernel::ListValidator< TYPE >::isEmpty(), Mantid::Kernel::ListValidator< TYPE >::m_allowedValues, and value.
|
inlineoverride |
Clone the validator.
Definition at line 56 of file ListValidator.h.
|
inlineoverride |
Return an allowed value (as a string) given an alias.
| alias | :: An alias string. |
Definition at line 88 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_aliases.
|
inlineprotected |
Test if a value is an alias of an alowed value.
| value | :: Value to test. |
Definition at line 153 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_aliases, and value.
|
inlineprotected |
Test if a value is an alias of an alowed value.
| value | :: Value to test. |
Definition at line 143 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_aliases, and value.
Referenced by Mantid::Kernel::ListValidator< TYPE >::checkValidity().
|
inlineprotected |
Is the value considered empty.
Specialized string version to use empty
| value | :: The value to check |
Definition at line 136 of file ListValidator.h.
References value.
|
inlineprotected |
Is the value considered empty.
| value | :: The value to check |
Definition at line 130 of file ListValidator.h.
References UNUSED_ARG, and value.
Referenced by Mantid::Kernel::StartsWithValidator::checkValidity(), and Mantid::Kernel::ListValidator< TYPE >::checkValidity().
|
inlineoverride |
Definition at line 96 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_allowMultiSelection.
|
inline |
Definition at line 98 of file ListValidator.h.
References Mantid::Kernel::ListValidator< TYPE >::m_allowMultiSelection.
|
protected |
The optional aliases for the allowed values.
Definition at line 158 of file ListValidator.h.
Referenced by Mantid::Kernel::ListValidator< TYPE >::getValueForAlias(), Mantid::Kernel::ListValidator< TYPE >::isAlias(), and Mantid::Kernel::ListValidator< TYPE >::ListValidator().
|
protected |
The set of valid values.
Definition at line 156 of file ListValidator.h.
Referenced by Mantid::Kernel::ListValidator< TYPE >::addAllowedValue(), Mantid::Kernel::ListValidator< TYPE >::allowedValues(), Mantid::Kernel::StartsWithValidator::checkValidity(), and Mantid::Kernel::ListValidator< TYPE >::checkValidity().
|
protected |
if the validator should allow multiple selection
Definition at line 161 of file ListValidator.h.
Referenced by Mantid::Kernel::ListValidator< TYPE >::isMultipleSelectionAllowed(), Mantid::Kernel::ListValidator< TYPE >::ListValidator(), and Mantid::Kernel::ListValidator< TYPE >::setMultipleSelectionAllowed().