1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-02 06:40:12 +01:00

Move ComponentInterfaceSymbol to separate header file

This commit is contained in:
Paul Licameli
2021-02-18 08:17:03 -05:00
committed by Panagiotis Vasilopoulos
parent 8a90ab94c3
commit 67b0f8a869
12 changed files with 22 additions and 151 deletions

View File

@@ -48,66 +48,8 @@
STRINGS_API const wxString& GetCustomTranslation(const wxString& str1 );
/**************************************************************************//**
\brief ComponentInterfaceSymbol pairs a persistent string identifier used internally
with an optional, different string as msgid for lookup in a translation catalog.
\details If there is need to change a msgid in a later version of the
program, change the constructor call to supply a second argument but leave the
first the same, so that compatibility of older configuration files containing
that internal string is not broken.
********************************************************************************/
class ComponentInterfaceSymbol
{
public:
ComponentInterfaceSymbol() = default;
// Allows implicit construction from a msgid re-used as an internal string
ComponentInterfaceSymbol( const TranslatableString &msgid )
: mInternal{ msgid.MSGID().GET(), }, mMsgid{ msgid }
{}
// Allows implicit construction from an internal string re-used as a msgid
ComponentInterfaceSymbol( const wxString &internal )
: mInternal{ internal }, mMsgid{ internal, {} }
{}
// Allows implicit construction from an internal string re-used as a msgid
ComponentInterfaceSymbol( const wxChar *msgid )
: mInternal{ msgid }, mMsgid{ msgid, {} }
{}
// Two-argument version distinguishes internal from translatable string
// such as when the first squeezes spaces out
ComponentInterfaceSymbol( const Identifier &internal,
const TranslatableString &msgid )
: mInternal{ internal.GET() }
// Do not permit non-empty msgid with empty internal
, mMsgid{ internal.empty() ? TranslatableString{} : msgid }
{}
const wxString &Internal() const { return mInternal; }
const TranslatableString &Msgid() const { return mMsgid; }
const TranslatableString Stripped() const { return mMsgid.Stripped(); }
const wxString Translation() const { return mMsgid.Translation(); }
const wxString StrippedTranslation() const
{ return Stripped().Translation(); }
bool empty() const { return mInternal.empty(); }
friend inline bool operator == (
const ComponentInterfaceSymbol &a, const ComponentInterfaceSymbol &b )
{ return a.mInternal == b.mInternal; }
friend inline bool operator != (
const ComponentInterfaceSymbol &a, const ComponentInterfaceSymbol &b )
{ return !( a == b ); }
private:
wxString mInternal;
TranslatableString mMsgid;
};
class ComponentInterfaceSymbol;
using VendorSymbol = ComponentInterfaceSymbol;
class ShuttleParams;

View File

@@ -50,6 +50,7 @@
#include <algorithm>
#include "ComponentInterface.h"
#include "ComponentInterfaceSymbol.h"
/**

View File

@@ -46,6 +46,7 @@
#include "Identifier.h"
#include "audacity/ComponentInterface.h"
#include "ComponentInterfaceSymbol.h"
#include "audacity/ConfigInterface.h"
#include "audacity/EffectAutomationParameters.h" // for command automation

View File

@@ -256,17 +256,4 @@ typedef enum
ChannelNameBottomFrontRight,
} ChannelName, *ChannelNames;
// ----------------------------------------------------------------------------
// some frequently needed forward declarations
// ----------------------------------------------------------------------------
class ComponentInterfaceSymbol;
using EnumValueSymbol = ComponentInterfaceSymbol;
using NumericFormatSymbol = EnumValueSymbol;
using VendorSymbol = ComponentInterfaceSymbol;
using EffectFamilySymbol = ComponentInterfaceSymbol;
#endif // __AUDACITY_TYPES_H__