Audacity  2.2.2
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:
Validator

Public Member Functions

virtual bool Validate (const wxVariant &v)
 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 char array of booleans, e.g. "011010001".

Definition at line 153 of file Validators.h.

Member Function Documentation

Holder BoolArrayValidator::GetClone ( ) const
inlineoverridevirtual

Implements Validator.

Definition at line 171 of file Validators.h.

172  {
173  return std::make_unique<BoolArrayValidator>();
174  }
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 167 of file Validators.h.

168  {
169  return wxT("0X101XX101...etc. where 0=false, 1=true, and X=don't care. Numbering starts at leftmost = track 0");
170  }
virtual bool BoolArrayValidator::Validate ( const wxVariant &  v)
inlinevirtual

Judge whether the passed value satisfies the Validator.

Reimplemented from Validator.

Definition at line 156 of file Validators.h.

References Validator::SetConverted().

157  {
158  wxString val; // Validate a string of chars containing only 0, 1 and x.
159  if (!v.Convert(&val))
160  return false;
161  SetConverted(val);
162  for(size_t i=0; i != val.Len(); i++)
163  if( val[i] != '0' && val[i] != '1' && val[i] != 'x' && val[i] != 'X')
164  return false;
165  return true;
166  }
void SetConverted(const wxVariant &v)
Definition: Validators.h:56

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