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

Parameter must be char array of booleans, e.g. "011010001". More...

#include <Validators.h>

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

Public Member Functions

virtual 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 char array of booleans, e.g. "011010001".

Definition at line 158 of file Validators.h.

Member Function Documentation

◆ GetClone()

Holder BoolArrayValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 176 of file Validators.h.

177 {
178 return std::make_unique<BoolArrayValidator>();
179 }

◆ GetDescription()

wxString BoolArrayValidator::GetDescription ( ) const
inlineoverridevirtual

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

Reimplemented from Validator.

Definition at line 172 of file Validators.h.

173 {
174 return wxT("0X101XX101...etc. where 0=false, 1=true, and X=don't care. Numbering starts at leftmost = track 0");
175 }
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ Validate()

virtual bool BoolArrayValidator::Validate ( const wxVariant &  v)
inlineoverridevirtual

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 161 of file Validators.h.

162 {
163 wxString val; // Validate a string of chars containing only 0, 1 and x.
164 if (!v.Convert(&val))
165 return false;
166 SetConverted(val);
167 for(size_t i=0; i != val.length(); i++)
168 if( val[i] != '0' && val[i] != '1' && val[i] != 'x' && val[i] != 'X')
169 return false;
170 return true;
171 }
void SetConverted(const wxVariant &v)
Definition: Validators.h:61

References Validator::SetConverted().

Here is the call graph for this function:

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