Audacity  3.0.3
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 } {}

◆ 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 ); }

◆ Identifier() [7/8]

Identifier::Identifier ( Identifier &&  id)
inline

Definition at line 43 of file Identifier.h.

44  { swap( id ); }

◆ 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 }

References value.

Member Function Documentation

◆ empty()

bool Identifier::empty ( ) const
inline

Definition at line 61 of file Identifier.h.

61 { return value.empty(); }

Referenced by anonymous_namespace{Registry.cpp}::CollectItem(), GetInfoCommand::ExploreMenu(), EffectManager::GetEffectByIdentifier(), CommandManager::HandleTextualCommand(), EffectUIHost::Initialize(), MacrosWindow::InsertCommandAt(), CommandManager::NewIdentifier(), EffectUIHost::OnHelp(), ThemeBase::ReadImageCache(), and HelpSystem::ShowHelp().

Here is the caller graph for this function:

◆ GET()

const wxString& Identifier::GET ( ) const
inline

◆ 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 ); }

Referenced by TaggedIdentifier< Tag, CaseSensitive >::Identifier().

Here is the caller graph for this function:

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:
str
#define str(a)
Definition: DBConnection.cpp:30
Identifier::value
wxString value
Definition: Identifier.h:71
Identifier::swap
void swap(Identifier &id)
Definition: Identifier.h:53