Audacity 3.2.0
Public Member Functions | List of all members
IntValidator Class Referencefinal

Parameter must be integral. More...

#include <Validators.h>

Inheritance diagram for IntValidator:
[legend]
Collaboration diagram for IntValidator:
[legend]

Public Member Functions

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
 

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 be integral.

Definition at line 227 of file Validators.h.

Member Function Documentation

◆ GetClone()

Holder IntValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 242 of file Validators.h.

243 {
244 return std::make_unique<IntValidator>();
245 }

◆ GetDescription()

wxString IntValidator::GetDescription ( ) const
inlineoverridevirtual

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

Reimplemented from Validator.

Definition at line 238 of file Validators.h.

239 {
240 return wxT("an integer");
241 }
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ Validate()

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

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 230 of file Validators.h.

231 {
232 double val;
233 if (!v.Convert(&val)) return false;
234 SetConverted(val);
235 if (!GetConverted().IsType(wxT("double"))) return false;
236 return ((long)val == val);
237 }
const wxVariant & GetConverted()
Definition: Validators.h:65
void SetConverted(const wxVariant &v)
Definition: Validators.h:61

References Validator::GetConverted(), Validator::SetConverted(), and wxT().

Here is the call graph for this function:

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