JeVois  1.17
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 const std::string 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

const boost::regex 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)
explicit

Construct from a given regex that specifies valid values.

◆ ~ValidValuesSpecRegex()

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

Destructor.

Member Function Documentation

◆ checkValueValidity()

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

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

Implements jevois::ValidValuesSpecBase< T >.

◆ str()

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

Convert to a readable string.

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

Implements jevois::ValidValuesSpecBase< T >.

Member Data Documentation

◆ itsValidRegex

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

Th eregex that defines our valid values.

Definition at line 195 of file ValidValuesSpec.H.


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