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

A kind of Shuttle to exchange data with preferences e.g. the registry. More...

#include <ShuttlePrefs.h>

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

Public Member Functions

 ShuttlePrefs ()
 
virtual ~ShuttlePrefs ()
 
bool TransferBool (const wxString &Name, bool &bValue, const bool &bDefault) override
 
bool TransferDouble (const wxString &Name, double &dValue, const double &dDefault) override
 
bool TransferInt (const wxString &Name, int &iValue, const int &iDefault) override
 
bool TransferString (const wxString &Name, wxString &strValue, const wxString &strDefault) override
 
bool TransferWrappedType (const wxString &Name, WrappedType &W) override
 
bool ExchangeWithMaster (const wxString &Name) override
 
- Public Member Functions inherited from Shuttle
 Shuttle ()
 
virtual ~Shuttle ()
 
virtual bool TransferBool (const wxString &Name, bool &bValue, const bool &bDefault)
 
virtual bool TransferFloat (const wxString &Name, float &fValue, const float &fDefault)
 
virtual bool TransferDouble (const wxString &Name, double &dValue, const double &dDefault)
 
virtual bool TransferInt (const wxString &Name, int &iValue, const int &iDefault)
 
virtual bool TransferInt (const wxString &Name, wxLongLong_t &iValue, const wxLongLong_t &iDefault)
 
virtual bool TransferLongLong (const wxString &Name, wxLongLong_t &iValue, const wxLongLong_t &iDefault)
 
virtual bool TransferString (const wxString &Name, wxString &strValue, const wxString &strDefault)
 
virtual bool TransferEnum (const wxString &Name, int &iValue, const int nChoices, const wxString *pFirstStr)
 
virtual bool TransferWrappedType (const wxString &Name, WrappedType &W)
 
virtual bool ExchangeWithMaster (const wxString &Name)
 

Additional Inherited Members

- Public Attributes inherited from Shuttle
bool mbStoreInClient
 
wxString mValueString
 

Detailed Description

A kind of Shuttle to exchange data with preferences e.g. the registry.

This class may be used by ShuttleGui to do the two step exchange,

     Gui -- Data -- Prefs

Definition at line 17 of file ShuttlePrefs.h.

Constructor & Destructor Documentation

◆ ShuttlePrefs()

ShuttlePrefs::ShuttlePrefs ( )
inline

Definition at line 21 of file ShuttlePrefs.h.

21{;};

◆ ~ShuttlePrefs()

virtual ShuttlePrefs::~ShuttlePrefs ( )
inlinevirtual

Definition at line 22 of file ShuttlePrefs.h.

22{};

Member Function Documentation

◆ ExchangeWithMaster()

bool ShuttlePrefs::ExchangeWithMaster ( const wxString &  Name)
overridevirtual

Reimplemented from Shuttle.

Definition at line 117 of file ShuttlePrefs.cpp.

118{
119 // ShuttlePrefs is unusual in that it overloads ALL the Transfer functions
120 // which it supports. It doesn't do any string conversion, because wxConv will
121 // do so if it is required.
122 // So, ExchangeWithMaster should never get called... Hence the ASSERT here.
123 wxASSERT( false );
124 return false;
125}

◆ TransferBool()

bool ShuttlePrefs::TransferBool ( const wxString &  Name,
bool &  bValue,
const bool &  bDefault 
)
overridevirtual

Reimplemented from Shuttle.

Definition at line 35 of file ShuttlePrefs.cpp.

36{
37 if( mbStoreInClient )
38 {
39 bValue = bDefault;
40 gPrefs->Read( Name, &bValue );
41 }
42 else
43 {
44 return gPrefs->Write( Name, bValue );
45 }
46 return true;
47}
FileConfig * gPrefs
Definition: Prefs.cpp:71
bool mbStoreInClient
Definition: Shuttle.h:77

References gPrefs, and Shuttle::mbStoreInClient.

Referenced by TransferWrappedType().

Here is the caller graph for this function:

◆ TransferDouble()

bool ShuttlePrefs::TransferDouble ( const wxString &  Name,
double &  dValue,
const double &  dDefault 
)
overridevirtual

Reimplemented from Shuttle.

Definition at line 49 of file ShuttlePrefs.cpp.

50{
51 if( mbStoreInClient )
52 {
53 dValue = dDefault;
54 gPrefs->Read( Name, &dValue );
55 }
56 else
57 {
58 return gPrefs->Write( Name, dValue );
59 }
60 return true;
61}

References gPrefs, and Shuttle::mbStoreInClient.

Referenced by TransferWrappedType().

Here is the caller graph for this function:

◆ TransferInt()

bool ShuttlePrefs::TransferInt ( const wxString &  Name,
int &  iValue,
const int &  iDefault 
)
overridevirtual

Reimplemented from Shuttle.

Definition at line 63 of file ShuttlePrefs.cpp.

64{
65 if( mbStoreInClient )
66 {
67 iValue = iDefault;
68 gPrefs->Read( Name, &iValue );
69 }
70 else
71 {
72 return gPrefs->Write( Name, iValue );
73 }
74 return true;
75}

References gPrefs, and Shuttle::mbStoreInClient.

Referenced by TransferWrappedType().

Here is the caller graph for this function:

◆ TransferString()

bool ShuttlePrefs::TransferString ( const wxString &  Name,
wxString &  strValue,
const wxString &  strDefault 
)
overridevirtual

Reimplemented from Shuttle.

Definition at line 77 of file ShuttlePrefs.cpp.

78{
79 if( mbStoreInClient )
80 {
81 strValue = strDefault;
82 gPrefs->Read( Name, &strValue );
83 }
84 else
85 {
86 return gPrefs->Write( Name, strValue );
87 }
88 return true;
89}

References gPrefs, and Shuttle::mbStoreInClient.

Referenced by TransferWrappedType().

Here is the caller graph for this function:

◆ TransferWrappedType()

bool ShuttlePrefs::TransferWrappedType ( const wxString &  Name,
WrappedType W 
)
overridevirtual

Reimplemented from Shuttle.

Definition at line 91 of file ShuttlePrefs.cpp.

92{
93 switch( W.eWrappedType )
94 {
95 case eWrappedString:
96 return TransferString( Name, *W.mpStr, *W.mpStr );
97 break;
98 case eWrappedInt:
99 return TransferInt( Name, *W.mpInt, *W.mpInt );
100 break;
101 case eWrappedDouble:
102 return TransferDouble( Name, *W.mpDouble, *W.mpDouble );
103 break;
104 case eWrappedBool:
105 return TransferBool( Name, *W.mpBool, *W.mpBool );
106 break;
107 case eWrappedEnum:
108 wxASSERT( false );
109 break;
110 default:
111 wxASSERT( false );
112 break;
113 }
114 return false;
115}
#define W(N, I)
Definition: ToChars.cpp:60
@ eWrappedDouble
Definition: WrappedType.h:22
@ eWrappedEnum
Definition: WrappedType.h:24
@ eWrappedInt
Definition: WrappedType.h:21
@ eWrappedBool
Definition: WrappedType.h:23
@ eWrappedString
Definition: WrappedType.h:20
bool TransferString(const wxString &Name, wxString &strValue, const wxString &strDefault) override
bool TransferInt(const wxString &Name, int &iValue, const int &iDefault) override
bool TransferDouble(const wxString &Name, double &dValue, const double &dDefault) override
bool TransferBool(const wxString &Name, bool &bValue, const bool &bDefault) override

References eWrappedBool, eWrappedDouble, eWrappedEnum, eWrappedInt, eWrappedString, TransferBool(), TransferDouble(), TransferInt(), TransferString(), and W.

Here is the call graph for this function:

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