Audacity 3.2.0
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:
[legend]
Collaboration diagram for RangeValidator:
[legend]

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 ()
 
virtual bool Validate (const wxVariant &v)
 Judge whether the passed value satisfies the Validator. More...
 
virtual wxString GetDescription () const
 
virtual Holder GetClone () const =0
 

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 201 of file Validators.h.

Constructor & Destructor Documentation

◆ RangeValidator()

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

Definition at line 206 of file Validators.h.

207 : mLower(l), mUpper(u)
208 { }

Member Function Documentation

◆ GetClone()

Holder RangeValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 220 of file Validators.h.

221 {
222 return std::make_unique<RangeValidator>(mLower, mUpper);
223 }

References mLower, and mUpper.

◆ GetDescription()

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 216 of file Validators.h.

217 {
218 return wxString::Format(wxT("between %f and %f"), mLower, mUpper);
219 }
wxT("CloseDown"))

References mLower, mUpper, and wxT().

Here is the call graph for this function:

◆ Validate()

bool RangeValidator::Validate ( const wxVariant &  v)
inlineoverridevirtual

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 209 of file Validators.h.

210 {
211 double val;
212 if (!v.Convert(&val)) return false;
213 SetConverted(val);
214 return ((mLower < val) && (val < mUpper));
215 }
void SetConverted(const wxVariant &v)
Definition: Validators.h:60

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

Here is the call graph for this function:

Member Data Documentation

◆ mLower

double RangeValidator::mLower
private

Definition at line 204 of file Validators.h.

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

◆ mUpper

double RangeValidator::mUpper
private

Definition at line 204 of file Validators.h.

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


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