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

Parameter must be integral. More...

#include <Validators.h>

Inheritance diagram for IntValidator:

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 ()

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

Member Function Documentation

Holder IntValidator::GetClone ( ) const

Implements Validator.

Definition at line 237 of file Validators.h.

238  {
239  return std::make_unique<IntValidator>();
240  }
wxString IntValidator::GetDescription ( ) const

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

Reimplemented from Validator.

Definition at line 233 of file Validators.h.

234  {
235  return wxT("an integer");
236  }
bool IntValidator::Validate ( const wxVariant &  v)

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 225 of file Validators.h.

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

226  {
227  double val;
228  if (!v.Convert(&val)) return false;
229  SetConverted(val);
230  if (!GetConverted().IsType(wxT("double"))) return false;
231  return ((long)val == val);
232  }
const wxVariant & GetConverted()
Definition: Validators.h:60
void SetConverted(const wxVariant &v)
Definition: Validators.h:56

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