Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Mantid::Kernel::StartsWithValidator Class Reference

StartsWithValidator is a validator that requires the value of a property to start with one of the strings in a defined list of possibilities. More...

#include <StartsWithValidator.h>

Inheritance diagram for Mantid::Kernel::StartsWithValidator:
Mantid::Kernel::ListValidator< TYPE >

Public Member Functions

IValidator_sptr clone () const override
 Clone the validator. More...
 
 StartsWithValidator ()=default
 
template<std::size_t SIZE>
 StartsWithValidator (const std::array< std::string, SIZE > &values)
 Constructor. More...
 
 StartsWithValidator (const std::set< std::string > &values)
 Constructor. More...
 
 StartsWithValidator (const std::vector< std::string > &values)
 Constructor. More...
 
- Public Member Functions inherited from Mantid::Kernel::ListValidator< TYPE >
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 std::string &value) const override
 Checks if the string passed starts with one from the list. More...
 
- Protected Member Functions inherited from Mantid::Kernel::ListValidator< TYPE >
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...
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Kernel::ListValidator< TYPE >
std::map< std::string, std::string > m_aliases
 The optional aliases for the allowed values. More...
 
std::vector< TYPEm_allowedValues
 The set of valid values. More...
 
bool m_allowMultiSelection
 if the validator should allow multiple selection More...
 

Detailed Description

StartsWithValidator is a validator that requires the value of a property to start with one of the strings in a defined list of possibilities.

Definition at line 22 of file StartsWithValidator.h.

Constructor & Destructor Documentation

◆ StartsWithValidator() [1/4]

Mantid::Kernel::StartsWithValidator::StartsWithValidator ( )
default

◆ StartsWithValidator() [2/4]

Mantid::Kernel::StartsWithValidator::StartsWithValidator ( const std::vector< std::string > &  values)

Constructor.

Parameters
values:: A vector with the allowed values.

Definition at line 17 of file StartsWithValidator.cpp.

◆ StartsWithValidator() [3/4]

Mantid::Kernel::StartsWithValidator::StartsWithValidator ( const std::set< std::string > &  values)

Constructor.

Parameters
values:: A set with the allowed values.

Definition at line 23 of file StartsWithValidator.cpp.

◆ StartsWithValidator() [4/4]

template<std::size_t SIZE>
Mantid::Kernel::StartsWithValidator::StartsWithValidator ( const std::array< std::string, SIZE > &  values)
inline

Constructor.

Parameters
values:: An array with the allowed values

Definition at line 34 of file StartsWithValidator.h.

Member Function Documentation

◆ checkValidity()

std::string Mantid::Kernel::StartsWithValidator::checkValidity ( const std::string &  value) const
overrideprotected

Checks if the string passed starts with one from the list.

Parameters
value:: The value to test
Returns
"" if the value is on the list, or "The value does not start with any of the allowed values"

Definition at line 33 of file StartsWithValidator.cpp.

References Mantid::Kernel::ListValidator< TYPE >::isEmpty(), Mantid::Kernel::ListValidator< TYPE >::m_allowedValues, and value.

◆ clone()

IValidator_sptr Mantid::Kernel::StartsWithValidator::clone ( ) const
override

Clone the validator.

Definition at line 26 of file StartsWithValidator.cpp.


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