Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Kernel::StringContainsValidator Class Reference

StringContainsValidator : A validator designed to ensure that a string input contain a given sub string or a set of sub strings. More...

#include <StringContainsValidator.h>

Inheritance diagram for Mantid::Kernel::StringContainsValidator:

Public Member Functions

IValidator_sptr clone () const override
 Clone the current state. More...
 
void setRequiredStrings (const std::vector< std::string > &)
 Allows a for a vector of required strings to be passed to the validator. More...
 
 StringContainsValidator ()
 Constructor. More...
 
 StringContainsValidator (const std::vector< std::string > &)
 Constructor with required sub strings. More...
 

Private Member Functions

std::string checkValidity (const std::string &value) const override
 Checks the value is valid. More...
 

Private Attributes

std::vector< std::string > m_requiredStrings
 A vector of the sub strings the string must contain in order to pass validation. More...
 

Detailed Description

StringContainsValidator : A validator designed to ensure that a string input contain a given sub string or a set of sub strings.

The sub strings should be case sensitive

Author
Elliot Oram, ISIS, RAL
Date
05/08/2015

Definition at line 22 of file StringContainsValidator.h.

Constructor & Destructor Documentation

◆ StringContainsValidator() [1/2]

Mantid::Kernel::StringContainsValidator::StringContainsValidator ( )

Constructor.

Definition at line 14 of file StringContainsValidator.cpp.

◆ StringContainsValidator() [2/2]

Mantid::Kernel::StringContainsValidator::StringContainsValidator ( const std::vector< std::string > &  strings)

Constructor with required sub strings.

Definition at line 18 of file StringContainsValidator.cpp.

Member Function Documentation

◆ checkValidity()

std::string Mantid::Kernel::StringContainsValidator::checkValidity ( const std::string &  value) const
overrideprivate

Checks the value is valid.

Parameters
valueA string to check if it contains required sub strings
Returns
An empty string if the value is valid or an string containing a description of the error otherwise

Definition at line 39 of file StringContainsValidator.cpp.

References error, m_requiredStrings, position, and value.

◆ clone()

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

Clone the current state.

Returns
A clone of the current state of the validator

Definition at line 24 of file StringContainsValidator.cpp.

◆ setRequiredStrings()

void Mantid::Kernel::StringContainsValidator::setRequiredStrings ( const std::vector< std::string > &  strings)

Allows a for a vector of required strings to be passed to the validator.

Parameters
stringsThe vector of sub strings that need to be included to pass validation

Definition at line 30 of file StringContainsValidator.cpp.

References m_requiredStrings.

Member Data Documentation

◆ m_requiredStrings

std::vector<std::string> Mantid::Kernel::StringContainsValidator::m_requiredStrings
private

A vector of the sub strings the string must contain in order to pass validation.

Definition at line 39 of file StringContainsValidator.h.

Referenced by checkValidity(), and setRequiredStrings().


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