mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Define class Identifier and template TaggedIdentifier...
... Identifier holds strings used for internal purposes and not shown to users; TaggedIdentifier generates subclasses of Identifier for different purposes, which won't implicitly (that is, inadvertently) interconvert as function arguments.
This commit is contained in:
@@ -310,3 +310,25 @@ wxArrayStringEx LocalizedStrings(
|
||||
std::mem_fn( &EnumValueSymbol::Translation )
|
||||
);
|
||||
}
|
||||
|
||||
// Find a better place for this?
|
||||
#include "audacity/Types.h"
|
||||
Identifier::Identifier(
|
||||
std::initializer_list<Identifier> components, wxChar separator )
|
||||
{
|
||||
if( components.size() < 2 )
|
||||
{
|
||||
wxASSERT( false );
|
||||
return;
|
||||
}
|
||||
auto iter = components.begin(), end = components.end();
|
||||
value = (*iter++).value;
|
||||
while (iter != end)
|
||||
value += separator + (*iter++).value;
|
||||
}
|
||||
|
||||
std::vector< Identifier > Identifier::split( wxChar separator ) const
|
||||
{
|
||||
auto strings = ::wxSplit( value, separator );
|
||||
return { strings.begin(), strings.end() };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user