Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
Identifier Class Reference

An explicitly nonlocalized string, not meant for the user to see. More...

#include <Identifier.h>

Inheritance diagram for Identifier:
[legend]

Public Member Functions

 Identifier ()=default
 
 Identifier (const wxString &str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const wxChar *str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const char *str)
 Allow implicit conversion to this class, but not from. More...
 
 Identifier (const Identifier &)=default
 
Identifieroperator= (const Identifier &)=default
 
 Identifier (wxString &&str)
 
 Identifier (Identifier &&id)
 
Identifieroperator= (Identifier &&id)
 
void swap (Identifier &id)
 
 Identifier (std::initializer_list< Identifier > components, wxChar separator)
 Convenience for building concatenated identifiers. More...
 
bool empty () const
 
size_t size () const
 
size_t length () const
 
const wxString & GET () const
 Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct. More...
 
std::vector< Identifiersplit (wxChar separator) const
 

Private Attributes

wxString value
 

Detailed Description

An explicitly nonlocalized string, not meant for the user to see.

String manipulations are discouraged, other than splitting and joining on separator characters. Wherever GET is used to fetch the underlying wxString, there should be a comment explaining the need for it.

Definition at line 21 of file Identifier.h.

Constructor & Destructor Documentation

◆ Identifier() [1/8]

Identifier::Identifier ( )
default

◆ Identifier() [2/8]

Identifier::Identifier ( const wxString &  str)
inline

Allow implicit conversion to this class, but not from.

Definition at line 28 of file Identifier.h.

28: value{ str } {}
#define str(a)
wxString value
Definition: Identifier.h:71

◆ Identifier() [3/8]

Identifier::Identifier ( const wxChar *  str)
inline

Allow implicit conversion to this class, but not from.

Definition at line 31 of file Identifier.h.

31: value{ str } {}

◆ Identifier() [4/8]

Identifier::Identifier ( const char *  str)
inline

Allow implicit conversion to this class, but not from.

Definition at line 34 of file Identifier.h.

34: value{ str } {}

◆ Identifier() [5/8]

Identifier::Identifier ( const Identifier )
default

◆ Identifier() [6/8]

Identifier::Identifier ( wxString &&  str)
inline

Definition at line 41 of file Identifier.h.

42 { value.swap( str ); }

References str.

◆ Identifier() [7/8]

Identifier::Identifier ( Identifier &&  id)
inline

Definition at line 43 of file Identifier.h.

44 { swap( id ); }
void swap(Identifier &id)
Definition: Identifier.h:53

References anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

◆ Identifier() [8/8]

Identifier::Identifier ( std::initializer_list< Identifier components,
wxChar  separator 
)
explicit

Convenience for building concatenated identifiers.

The list must have at least two members (so you don't easily circumvent the restrictions on interconversions intended in TaggedIdentifier below)

Definition at line 14 of file Identifier.cpp.

16{
17 if( components.size() < 2 )
18 {
19 wxASSERT( false );
20 return;
21 }
22 auto iter = components.begin(), end = components.end();
23 value = (*iter++).value;
24 while (iter != end)
25 value += separator + (*iter++).value;
26}
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References details::end(), and value.

Here is the call graph for this function:

Member Function Documentation

◆ empty()

bool Identifier::empty ( ) const
inline

◆ GET()

const wxString & Identifier::GET ( ) const
inline

Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct.

Definition at line 66 of file Identifier.h.

66{ return value; }

Referenced by audacity::cloud::audiocom::sync::AudioComDialogBase::AudioComDialogBase(), TaggedIdentifier< Tag, CaseSensitive >::CONVERT(), ProjectStatus::DefaultFieldsRegistrator::DefaultFieldsRegistrator(), NormalizedKeyString::Display(), Journal::WindowPaths::FindByPath(), anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl(), CommandManager::CommandListEntry::FormatLabelForMenu(), audacity::cloud::audiocom::sync::anonymous_namespace{AudioComDialogBase.cpp}::GetOptionalPrefsIdentifier(), KeyConfigPrefs::MergeWithExistingKeys(), CommandManager::Populator::NewIdentifier(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectly(), CommandDispatch::OnAudacityCommand(), anonymous_namespace{PluginMenus.cpp}::OnEffect(), ErrorDialog::OnHelp(), ErrorReportDialog::OnHelp(), MacroCommandDialog::OnItemSelected(), AudioUnitEffectOptionsDialog::OnOk(), OpenInDefaultBrowser(), operator<(), operator==(), TimeToolBar::Populate(), ProjectSelectionManager::SetBandwidthSelectionFormatName(), SpectralSelectionBar::SetBandwidthSelectionFormatName(), ProjectSelectionManager::SetFrequencySelectionFormatName(), SpectralSelectionBar::SetFrequencySelectionFormatName(), ProjectSnap::SetSnapTo(), HelpSystem::ShowHelp(), EffectChangeSpeed::TransferDataFromWindow(), SpectralSelectionBar::UpdatePrefs(), TimeToolBar::UpdatePrefs(), Journal::Events::anonymous_namespace{JournalEvents.cpp}::WindowEventName(), XMLUtf8BufferWriter::WriteAttr(), XMLWriter::WriteAttr(), and ToolManager::WriteConfig().

Here is the caller graph for this function:

◆ length()

size_t Identifier::length ( ) const
inline

Definition at line 63 of file Identifier.h.

63{ return value.length(); }

◆ operator=() [1/2]

Identifier & Identifier::operator= ( const Identifier )
default

◆ operator=() [2/2]

Identifier & Identifier::operator= ( Identifier &&  id)
inline

Definition at line 45 of file Identifier.h.

46 {
47 if ( this != &id )
48 value.clear(), swap( id );
49 return *this;
50 }

References anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

◆ size()

size_t Identifier::size ( ) const
inline

Definition at line 62 of file Identifier.h.

62{ return value.size(); }

◆ split()

std::vector< Identifier > Identifier::split ( wxChar  separator) const

Definition at line 28 of file Identifier.cpp.

29{
30 auto strings = ::wxSplit( value, separator );
31 return { strings.begin(), strings.end() };
32}

References value.

◆ swap()

void Identifier::swap ( Identifier id)
inline

Definition at line 53 of file Identifier.h.

53{ value.swap( id.value ); }

Member Data Documentation

◆ value

wxString Identifier::value
private

Definition at line 71 of file Identifier.h.

Referenced by Identifier(), and split().


The documentation for this class was generated from the following files: