Audacity 3.2.0
ComponentInterfaceSymbol.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file ComponentInterfaceSymbol.h
6
7 Paul Licameli split from ComponentInterface.h
8
9**********************************************************************/
10
11#ifndef __AUDACITY_COMPONENT_INTERFACE_SYMBOL__
12#define __AUDACITY_COMPONENT_INTERFACE_SYMBOL__
13
14#include "Identifier.h"
15#include "Internat.h"
16
17/**************************************************************************/
27{
28public:
30
31 // Allows implicit construction from a msgid re-used as an internal string
33 : mInternal{ msgid.MSGID().GET(), }, mMsgid{ msgid }
34 {}
35
36 // Allows implicit construction from an internal string re-used as a msgid
39 {}
40
41 // Allows implicit construction from an internal string re-used as a msgid
42 ComponentInterfaceSymbol( const wxChar *msgid )
43 : mInternal{ msgid }, mMsgid{ msgid, {} }
44 {}
45
46 // Two-argument version distinguishes internal from translatable string
47 // such as when the first squeezes spaces out
49 const TranslatableString &msgid )
50 : mInternal{ internal.GET() }
51 // Do not permit non-empty msgid with empty internal
52 , mMsgid{ internal.empty() ? TranslatableString{} : msgid }
53 {}
54
55 const wxString &Internal() const { return mInternal; }
56 const TranslatableString &Msgid() const { return mMsgid; }
57 const TranslatableString Stripped() const { return mMsgid.Stripped(); }
58 const wxString Translation() const { return mMsgid.Translation(); }
59 const wxString StrippedTranslation() const
60 { return Stripped().Translation(); }
61
62 bool empty() const { return mInternal.empty(); }
63
65 friend inline bool operator == (
67 { return a.mInternal == b.mInternal; }
68
69 friend inline bool operator != (
71 { return !( a == b ); }
72
74 friend inline bool operator < (
76 { return a.mInternal < b.mInternal; }
77
78private:
79 wxString mInternal;
81};
82
83// TODO: real type distinctions for these aliases, and move them elsewhere
87
88#endif
ComponentInterfaceSymbol EnumValueSymbol
bool operator<(sampleCount a, sampleCount b)
Definition: SampleCount.h:85
bool operator==(const WaveTrackLocation &a, const WaveTrackLocation &b)
bool operator!=(const WaveTrackLocation &a, const WaveTrackLocation &b)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
ComponentInterfaceSymbol(const Identifier &internal, const TranslatableString &msgid)
ComponentInterfaceSymbol(const wxString &internal)
ComponentInterfaceSymbol()=default
ComponentInterfaceSymbol(const wxChar *msgid)
const wxString & Internal() const
const TranslatableString & Msgid() const
const wxString StrippedTranslation() const
ComponentInterfaceSymbol(const TranslatableString &msgid)
const wxString Translation() const
const TranslatableString Stripped() const
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
Holds a msgid for the translation catalog; may also bind format arguments.
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object