Audacity  2.3.1
Public Member Functions | Private Attributes | List of all members
RangeValidator Class Referencefinal

Parameter must lie between the two given numbers. More...

#include <Validators.h>

Inheritance diagram for RangeValidator:
Validator

Public Member Functions

 RangeValidator (double l, double u)
 
bool Validate (const wxVariant &v) override
 Judge whether the passed value satisfies the Validator. More...
 
wxString GetDescription () const override
 
Holder GetClone () const override
 
- Public Member Functions inherited from Validator
 Validator ()
 
virtual ~Validator ()
 
void SetConverted (const wxVariant &v)
 
const wxVariant & GetConverted ()
 

Private Attributes

double mLower
 
double mUpper
 

Additional Inherited Members

- Public Types inherited from Validator
using Holder = std::unique_ptr< Validator >
 This MUST be overridden, to avoid slicing! More...
 

Detailed Description

Parameter must lie between the two given numbers.

Definition at line 197 of file Validators.h.

Constructor & Destructor Documentation

RangeValidator::RangeValidator ( double  l,
double  u 
)
inline

Definition at line 202 of file Validators.h.

203  : mLower(l), mUpper(u)
204  { }

Member Function Documentation

Holder RangeValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 216 of file Validators.h.

References mLower, and mUpper.

217  {
218  return std::make_unique<RangeValidator>(mLower, mUpper);
219  }
wxString RangeValidator::GetDescription ( ) const
inlineoverridevirtual

Return a description (for error messages) should be of the form 'v must be $description'

Reimplemented from Validator.

Definition at line 212 of file Validators.h.

References mLower, and mUpper.

213  {
214  return wxString::Format(wxT("between %f and %f"), mLower, mUpper);
215  }
bool RangeValidator::Validate ( const wxVariant &  v)
inlineoverridevirtual

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 205 of file Validators.h.

References mLower, mUpper, and Validator::SetConverted().

206  {
207  double val;
208  if (!v.Convert(&val)) return false;
209  SetConverted(val);
210  return ((mLower < val) && (val < mUpper));
211  }
void SetConverted(const wxVariant &v)
Definition: Validators.h:56

Member Data Documentation

double RangeValidator::mLower
private

Definition at line 200 of file Validators.h.

Referenced by GetClone(), GetDescription(), and Validate().

double RangeValidator::mUpper
private

Definition at line 200 of file Validators.h.

Referenced by GetClone(), GetDescription(), and Validate().


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