Audacity  2.2.2
Public Member Functions | List of all members
BoolValidator Class Referencefinal

Parameter must be a boolean. More...

#include <Validators.h>

Inheritance diagram for BoolValidator:
Validator

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 a boolean.

Definition at line 133 of file Validators.h.

Member Function Documentation

Holder BoolValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 147 of file Validators.h.

148  {
149  return std::make_unique<BoolValidator>();
150  }
wxString BoolValidator::GetDescription ( ) const
inlineoverridevirtual

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

Reimplemented from Validator.

Definition at line 143 of file Validators.h.

144  {
145  return wxT("true/false or 1/0 or yes/no");
146  }
bool BoolValidator::Validate ( const wxVariant &  v)
inlineoverridevirtual

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 136 of file Validators.h.

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

137  {
138  bool val;
139  if (!v.Convert(&val)) return false;
140  SetConverted(val);
141  return GetConverted().IsType(wxT("bool"));
142  }
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: