Audacity 3.2.0
WrappedType.h
Go to the documentation of this file.
1/**********************************************************************
2
3 WrappedType.h
4
5 James Crook
6 (C) Audacity Developers, 2007
7
8 wxWidgets license. See Licensing.txt
9
10*************************************************************************/
11
12#ifndef __WRAPPED_TYPE__
13#define __WRAPPED_TYPE__
14
15
16
18{
25};
26
27class wxString;
28class ShuttlePrefs;
29
30class AUDACITY_DLL_API WrappedType
31{
32public:
33
34 explicit WrappedType( wxString & InStr )
35 : eWrappedType{ eWrappedString }, mpStr{ &InStr }
36 {}
37 explicit WrappedType( int & InInt )
38 : eWrappedType{ eWrappedInt }, mpInt{ &InInt }
39 {}
40 explicit WrappedType( double & InDouble )
41 : eWrappedType{ eWrappedDouble }, mpDouble{ &InDouble }
42 {}
43 explicit WrappedType( bool & InBool )
44 : eWrappedType{ eWrappedBool }, mpBool{ &InBool }
45 {}
46 explicit WrappedType()
47 : eWrappedType{ eWrappedNotSet }
48 {}
49
50 bool IsString();
51
52 wxString ReadAsString();
53 int ReadAsInt();
54 double ReadAsDouble();
55 bool ReadAsBool();
56
57 void WriteToAsString( const wxString & InStr);
58 void WriteToAsInt( const int InInt);
59 void WriteToAsDouble( const double InDouble);
60 void WriteToAsBool( const bool InBool);
61
62public :
63
65 wxString *const mpStr {};
66 int *const mpInt {};
67 double *const mpDouble {};
68 bool *const mpBool {};
69
70};
71
72#endif
teWrappedType
Definition: WrappedType.h:18
@ eWrappedNotSet
Definition: WrappedType.h:19
@ 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
A kind of Shuttle to exchange data with preferences e.g. the registry.
Definition: ShuttlePrefs.h:18
Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions betw...
Definition: WrappedType.h:31
WrappedType(wxString &InStr)
Definition: WrappedType.h:34
WrappedType(int &InInt)
Definition: WrappedType.h:37
WrappedType(bool &InBool)
Definition: WrappedType.h:43
const teWrappedType eWrappedType
Definition: WrappedType.h:64
WrappedType(double &InDouble)
Definition: WrappedType.h:40