JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches

#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.
 
 ValidValuesSpecRegex (boost::regex const &valid_regex)
 Construct from a given regex that specifies valid values.
 
virtual ~ValidValuesSpecRegex ()
 Destructor.
 
virtual bool checkValueValidity (T const &val) const
 Check whether a proposed value is valid, returns true iff value is a match against our regex.
 
virtual std::string const str () const
 Convert to a readable string.
 
- Public Member Functions inherited from jevois::ValidValuesSpecBase< T >
 ValidValuesSpecBase ()
 Construct, for the base class this is a no-op.
 
virtual ~ValidValuesSpecBase ()
 Destructor.
 

Protected Attributes

boost::regex const itsValidRegex
 The regex that defines our valid values.
 

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 std::string const 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 >
boost::regex const jevois::ValidValuesSpecRegex< T >::itsValidRegex
protected

The regex that defines our valid values.

Definition at line 195 of file ValidValuesSpec.H.


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