JeVois  1.5
JeVois Smart Embedded Machine Vision Toolkit
Share this page:

#include <jevois/Component/ValidValuesSpec.H>

template<typename T>
class jevois::ValidValuesSpecRegex< T >

Regex-based valid values spec, everything that is a match to the regex is considered valid.

Uses boost::regex internally (because std::regex does not alow one to get the original string specification back from the regex, but we need that to display help messages). This allows for highly flexible valid values definitions. For example, say you want an int parameter to be in range [0..59] but it could also have value 72, your regex would be:

^(([0-5]?[0-9])|72)$

You can find on the web regex examples to match things like a valid filename, a valid URL, a valid credit card number, etc. Just make sure your regex is in the syntax expected by boost::regex since several syntaxes are floating around for regular expressions.

Definition at line 175 of file ValidValuesSpec.H.

Inheritance diagram for jevois::ValidValuesSpecRegex< T >:
Collaboration diagram for jevois::ValidValuesSpecRegex< T >:

Public Member Functions

 ValidValuesSpecRegex ()=delete
 No default constructor, always need to provide a regex. More...
 
 ValidValuesSpecRegex (boost::regex const &valid_regex)
 Construct from a given regex that specifies valid values. More...
 
virtual ~ValidValuesSpecRegex ()
 Destructor. More...
 
virtual bool checkValueValidity (T const &val) const
 Check whether a proposed value is valid, returns true iff value is a match against our regex. More...
 
virtual std::string const str () const
 Convert to a readable string. More...
 
- Public Member Functions inherited from jevois::ValidValuesSpecBase< T >
 ValidValuesSpecBase ()
 Construct, for the base class this is a no-op. More...
 
virtual ~ValidValuesSpecBase ()
 Destructor. More...
 

Protected Attributes

boost::regex const itsValidRegex
 Th eregex that defines our valid values. More...
 

Constructor & Destructor Documentation

◆ ValidValuesSpecRegex() [1/2]

template<typename T >
jevois::ValidValuesSpecRegex< T >::ValidValuesSpecRegex ( )
delete

No default constructor, always need to provide a regex.

◆ ValidValuesSpecRegex() [2/2]

template<typename T >
jevois::ValidValuesSpecRegex< T >::ValidValuesSpecRegex ( boost::regex const &  valid_regex)
inlineexplicit

Construct from a given regex that specifies valid values.

Definition at line 140 of file ValidValuesSpecImpl.H.

◆ ~ValidValuesSpecRegex()

template<typename T >
jevois::ValidValuesSpecRegex< T >::~ValidValuesSpecRegex ( )
inlinevirtual

Destructor.

Definition at line 145 of file ValidValuesSpecImpl.H.

Member Function Documentation

◆ checkValueValidity()

template<typename T >
bool jevois::ValidValuesSpecRegex< T >::checkValueValidity ( T const &  val) const
inlinevirtual

Check whether a proposed value is valid, returns true iff value is a match against our regex.

Implements jevois::ValidValuesSpecBase< T >.

Definition at line 149 of file ValidValuesSpecImpl.H.

References jevois::ValidValuesSpecRegex< T >::itsValidRegex, and jevois::paramValToString().

◆ str()

template<typename T >
std::string const jevois::ValidValuesSpecRegex< T >::str ( ) const
inlinevirtual

Convert to a readable string.

Returns Regex:[expression] where expression is replaced by the actual regex.

Implements jevois::ValidValuesSpecBase< T >.

Definition at line 156 of file ValidValuesSpecImpl.H.

References jevois::ValidValuesSpecRegex< T >::itsValidRegex.

Member Data Documentation

◆ itsValidRegex

template<typename T >
boost::regex const jevois::ValidValuesSpecRegex< T >::itsValidRegex
protected

Th eregex that defines our valid values.

Definition at line 195 of file ValidValuesSpec.H.

Referenced by jevois::ValidValuesSpecRegex< T >::checkValueValidity(), and jevois::ValidValuesSpecRegex< T >::str().


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