Audacity  2.2.0
WrappedType Class Reference

Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions between all the types. Functions that work on wrapped types can quickly be reused to work on any of these types. This cuts out a lot of repetitive code. More...

#include <WrappedType.h>

Public Member Functions

 WrappedType (wxString &InStr)
 
 WrappedType (int &InInt)
 
 WrappedType (double &InDouble)
 
 WrappedType (bool &InBool)
 
 WrappedType ()
 
void SetTo (wxString &InStr)
 
void SetTo (int &InInt)
 
void SetTo (double &InDouble)
 
void SetTo (bool &InBool)
 
bool IsString ()
 
wxString ReadAsString ()
 
int ReadAsInt ()
 
double ReadAsDouble ()
 
bool ReadAsBool ()
 
void WriteToAsString (const wxString &InStr)
 
void WriteToAsInt (const int InInt)
 
void WriteToAsDouble (const double InDouble)
 
void WriteToAsBool (const bool InBool)
 
bool ValuesMatch (const WrappedType &W)
 
void WriteToAsWrappedType (const WrappedType &W)
 
void Init ()
 

Public Attributes

teWrappedType eWrappedType
 
wxString * mpStr
 
int * mpInt
 
double * mpDouble
 
bool * mpBool
 

Detailed Description

Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions between all the types. Functions that work on wrapped types can quickly be reused to work on any of these types. This cuts out a lot of repetitive code.

JKC: This class grows in size with the square of the number of types it supports. It has to do all conversions between all pairs, so try to re-use existing types if you can.

It's probable that not all the cases are actually used in practice. The most heavily used will be conversions to <-> from string.

Constructor & Destructor Documentation

WrappedType::WrappedType ( wxString &  InStr)
inline
WrappedType::WrappedType ( int &  InInt)
inline
WrappedType::WrappedType ( double &  InDouble)
inline
WrappedType::WrappedType ( bool &  InBool)
inline
WrappedType::WrappedType ( )
inline

Member Function Documentation

void WrappedType::Init ( )
bool WrappedType::IsString ( )
Returns
true iff the wrapped type is a string.

References eWrappedString, and eWrappedType.

Referenced by ShuttleGuiBase::TieChoice().

void WrappedType::SetTo ( wxString &  InStr)
inline
void WrappedType::SetTo ( int &  InInt)
inline

References eWrappedInt.

void WrappedType::SetTo ( double &  InDouble)
inline

References eWrappedDouble.

void WrappedType::SetTo ( bool &  InBool)
inline

References eWrappedBool.

bool WrappedType::ValuesMatch ( const WrappedType W)
Parameters
WWrapped type to compare
Returns
true iff types and values are the same.

References eWrappedBool, eWrappedDouble, eWrappedEnum, eWrappedInt, eWrappedString, eWrappedType, mpBool, mpDouble, mpInt, and mpStr.

Referenced by ShuttleGuiBase::TieRadioButton().

void WrappedType::WriteToAsBool ( const bool  InBool)
void WrappedType::WriteToAsDouble ( const double  InDouble)
void WrappedType::WriteToAsWrappedType ( const WrappedType W)

Member Data Documentation


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