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

Constructor & Destructor Documentation

◆ RangeValidator()

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

Definition at line 207 of file Validators.h.

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

Member Function Documentation

◆ GetClone()

Holder RangeValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 221 of file Validators.h.

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

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

218 {
219 return wxString::Format(wxT("between %f and %f"), mLower, mUpper);
220 }
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 210 of file Validators.h.

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

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

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

◆ mUpper

double RangeValidator::mUpper
private

Definition at line 205 of file Validators.h.

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


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