Audacity  3.0.3
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 
27 class wxString;
28 class ShuttlePrefs;
29 
30 class AUDACITY_DLL_API WrappedType
31 {
32 public:
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 
62 public :
63 
65  wxString *const mpStr {};
66  int *const mpInt {};
67  double *const mpDouble {};
68  bool *const mpBool {};
69 
70 };
71 
72 #endif
eWrappedEnum
@ eWrappedEnum
Definition: WrappedType.h:24
WrappedType::WrappedType
WrappedType(bool &InBool)
Definition: WrappedType.h:43
eWrappedNotSet
@ eWrappedNotSet
Definition: WrappedType.h:19
WrappedType::WrappedType
WrappedType(wxString &InStr)
Definition: WrappedType.h:34
eWrappedInt
@ eWrappedInt
Definition: WrappedType.h:21
WrappedType::WrappedType
WrappedType(double &InDouble)
Definition: WrappedType.h:40
WrappedType::WrappedType
WrappedType(int &InInt)
Definition: WrappedType.h:37
eWrappedDouble
@ eWrappedDouble
Definition: WrappedType.h:22
WrappedType
Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions betw...
Definition: WrappedType.h:31
eWrappedString
@ eWrappedString
Definition: WrappedType.h:20
WrappedType::WrappedType
WrappedType()
Definition: WrappedType.h:46
ShuttlePrefs
A kind of Shuttle to exchange data with preferences e.g. the registry.
Definition: ShuttlePrefs.h:18
eWrappedBool
@ eWrappedBool
Definition: WrappedType.h:23
teWrappedType
teWrappedType
Definition: WrappedType.h:18
WrappedType::eWrappedType
const teWrappedType eWrappedType
Definition: WrappedType.h:64