limal
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
limal::ValueCheckBase Class Referenceabstract

Base class to check a value. More...

#include <ValueCheck.hpp>

Inheritance diagram for limal::ValueCheckBase:
limal::ValueCheck limal::ValueIntCheck limal::ValuePerlRECheck limal::ValuePosixRECheck

Public Member Functions

virtual ~ValueCheckBase ()
 
virtual bool isValid (const BLOCXX_NAMESPACE::String &value) const =0
 
virtual BLOCXX_NAMESPACE::String explain (const BLOCXX_NAMESPACE::String &value) const =0
 

Protected Member Functions

 ValueCheckBase ()
 

Private Member Functions

 ValueCheckBase (const ValueCheckBase &)
 
ValueCheckBaseoperator= (const ValueCheckBase &)
 

Private Attributes

BLOCXX_NAMESPACE::RefCount m_rcnt
 

Friends

class ValueCheck
 

Detailed Description

Base class to check a value.

The ValueCheckBase class, is a abstract base class, allowing to implement a single check on a string value.

A check derived from this class can be combined in ValueCheck class to expressions.

See Also
ValueRegExCheck, ValueIntCheck and the ValueCheck class.

Constructor & Destructor Documentation

virtual limal::ValueCheckBase::~ValueCheckBase ( )
inlinevirtual

Destructor.

limal::ValueCheckBase::ValueCheckBase ( )
inlineprotected

Default constructor.

limal::ValueCheckBase::ValueCheckBase ( const ValueCheckBase )
private

Copy constructor, private. Use the default constructor to implement a copy constructor in your derived class.

Member Function Documentation

virtual BLOCXX_NAMESPACE::String limal::ValueCheckBase::explain ( const BLOCXX_NAMESPACE::String &  value) const
pure virtual

Returns a string explaining / showing the check.

For example, if your check implements the evaluation whether the value (e.g. "2") is lower than 5, implement it as:

return blocxx::Format("MyCheck('%1' < 5)", value);

The resulting string will be "MyCheck('2' < 5)" if the value parameter string was "2".

Parameters
valueThe value to evaluate.
Returns
A string showing the check.

Implemented in limal::ValueCheck, limal::ValueIntCheck, limal::ValuePerlRECheck, and limal::ValuePosixRECheck.

virtual bool limal::ValueCheckBase::isValid ( const BLOCXX_NAMESPACE::String &  value) const
pure virtual

Evaluates a check for the specified string value parameter to a boolean or throws an exception on failure.

For example, if you want a check that evaluates whether the value (e.g. "2") is lower than 5, implement it as:

return (value.toInt() < 5);

The blocxx toInt() method may throw an string conversion exception.

Parameters
valueThe value to evaluate.
Returns
The boolean result of the check.

Implemented in limal::ValueCheck, limal::ValueIntCheck, limal::ValuePerlRECheck, and limal::ValuePosixRECheck.

ValueCheckBase& limal::ValueCheckBase::operator= ( const ValueCheckBase )
private

Copy operator, private.

Friends And Related Function Documentation

friend class ValueCheck
friend

Permit the ValueCheck class the access to the reference counter.

Member Data Documentation

BLOCXX_NAMESPACE::RefCount limal::ValueCheckBase::m_rcnt
private

The atomic reference counter variable.


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