Audacity 3.2.0
Public Types | Public Member Functions | List of all members
TaggedIdentifier< Tag, CaseSensitive > Class Template Reference

Template generates different TaggedIdentifier classes that don't interconvert implicitly. More...

#include <Identifier.h>

Inheritance diagram for TaggedIdentifier< Tag, CaseSensitive >:
[legend]
Collaboration diagram for TaggedIdentifier< Tag, CaseSensitive >:
[legend]

Public Types

using TagType = Tag
 

Public Member Functions

 TaggedIdentifier ()=default
 
 TaggedIdentifier (const TaggedIdentifier &)=default
 Copy allowed only for the same Tag class and case sensitivity. More...
 
 TaggedIdentifier (TaggedIdentifier &&)=default
 Move allowed only for the same Tag class and case sensitivity. More...
 
TaggedIdentifieroperator= (const TaggedIdentifier &)=default
 Copy allowed only for the same Tag class and case sensitivity. More...
 
TaggedIdentifieroperator= (TaggedIdentifier &&)=default
 Move allowed only for the same Tag class and case sensitivity. More...
 
template<typename Tag2 , bool b>
 TaggedIdentifier (const TaggedIdentifier< Tag2, b > &)=delete
 Copy prohibited for other Tag classes or case sensitivity. More...
 
template<typename Tag2 , bool b>
 TaggedIdentifier (TaggedIdentifier< Tag2, b > &&)=delete
 Move prohibited for other Tag classes or case sensitivity. More...
 
template<typename Tag2 , bool b>
TaggedIdentifieroperator= (const TaggedIdentifier< Tag2, b > &)=delete
 Copy prohibited for other Tag classes or case sensitivity. More...
 
template<typename Tag2 , bool b>
TaggedIdentifieroperator= (TaggedIdentifier< Tag2, b > &&)=delete
 Move prohibited for other Tag classes or case sensitivity. More...
 
 TaggedIdentifier (const Identifier &str)
 
template<typename String , typename = typename String::TagType>
String CONVERT () const
 Explicit conversion to another kind of TaggedIdentifier. More...
 
 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
 
 Identifier (wxString &&str)
 
 Identifier (Identifier &&id)
 
 Identifier (std::initializer_list< Identifier > components, wxChar separator)
 Convenience for building concatenated identifiers. More...
 
- Public Member Functions inherited from Identifier
 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
 

Detailed Description

template<typename Tag, bool CaseSensitive = true>
class TaggedIdentifier< Tag, CaseSensitive >

Template generates different TaggedIdentifier classes that don't interconvert implicitly.

The second template parameter determines whether comparisons are case sensitive; default is case sensitive

Definition at line 112 of file Identifier.h.

Member Typedef Documentation

◆ TagType

template<typename Tag , bool CaseSensitive = true>
using TaggedIdentifier< Tag, CaseSensitive >::TagType = Tag

Definition at line 116 of file Identifier.h.

Constructor & Destructor Documentation

◆ TaggedIdentifier() [1/6]

template<typename Tag , bool CaseSensitive = true>
TaggedIdentifier< Tag, CaseSensitive >::TaggedIdentifier ( )
default

◆ TaggedIdentifier() [2/6]

template<typename Tag , bool CaseSensitive = true>
TaggedIdentifier< Tag, CaseSensitive >::TaggedIdentifier ( const TaggedIdentifier< Tag, CaseSensitive > &  )
default

Copy allowed only for the same Tag class and case sensitivity.

◆ TaggedIdentifier() [3/6]

template<typename Tag , bool CaseSensitive = true>
TaggedIdentifier< Tag, CaseSensitive >::TaggedIdentifier ( TaggedIdentifier< Tag, CaseSensitive > &&  )
default

Move allowed only for the same Tag class and case sensitivity.

◆ TaggedIdentifier() [4/6]

template<typename Tag , bool CaseSensitive = true>
template<typename Tag2 , bool b>
TaggedIdentifier< Tag, CaseSensitive >::TaggedIdentifier ( const TaggedIdentifier< Tag2, b > &  )
delete

Copy prohibited for other Tag classes or case sensitivity.

◆ TaggedIdentifier() [5/6]

template<typename Tag , bool CaseSensitive = true>
template<typename Tag2 , bool b>
TaggedIdentifier< Tag, CaseSensitive >::TaggedIdentifier ( TaggedIdentifier< Tag2, b > &&  )
delete

Move prohibited for other Tag classes or case sensitivity.

◆ TaggedIdentifier() [6/6]

template<typename Tag , bool CaseSensitive = true>
TaggedIdentifier< Tag, CaseSensitive >::TaggedIdentifier ( const Identifier str)
inline

Allow implicit conversion to this class from un-tagged Identifier, but not from; resolution will use other overloads above if argument has a tag

Definition at line 145 of file Identifier.h.

145: Identifier{ str } {}
#define str(a)
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22

Member Function Documentation

◆ CONVERT()

template<typename Tag , bool CaseSensitive = true>
template<typename String , typename = typename String::TagType>
String TaggedIdentifier< Tag, CaseSensitive >::CONVERT ( ) const
inline

Explicit conversion to another kind of TaggedIdentifier.

Definition at line 149 of file Identifier.h.

150 { return String{ this->GET() }; }
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66

References Identifier::GET().

Here is the call graph for this function:

◆ Identifier() [1/8]

template<typename Tag , bool CaseSensitive = true>
Identifier::Identifier ( )
default

◆ Identifier() [2/8]

template<typename Tag , bool CaseSensitive = true>
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 } {}
wxString value
Definition: Identifier.h:71

◆ Identifier() [3/8]

template<typename Tag , bool CaseSensitive = true>
Identifier::Identifier ( const Identifier )
default

◆ Identifier() [4/8]

template<typename Tag , bool CaseSensitive = true>
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() [5/8]

template<typename Tag , bool CaseSensitive = true>
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() [6/8]

template<typename Tag , bool CaseSensitive = true>
Identifier::Identifier ( Identifier &&  id)
inline

Definition at line 43 of file Identifier.h.

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

◆ Identifier() [7/8]

template<typename Tag , bool CaseSensitive = true>
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 59 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

◆ Identifier() [8/8]

template<typename Tag , bool CaseSensitive = true>
Identifier::Identifier ( wxString &&  str)
inline

Definition at line 41 of file Identifier.h.

42 { value.swap( str ); }

◆ operator=() [1/4]

template<typename Tag , bool CaseSensitive = true>
TaggedIdentifier & TaggedIdentifier< Tag, CaseSensitive >::operator= ( const TaggedIdentifier< Tag, CaseSensitive > &  )
default

Copy allowed only for the same Tag class and case sensitivity.

◆ operator=() [2/4]

template<typename Tag , bool CaseSensitive = true>
template<typename Tag2 , bool b>
TaggedIdentifier & TaggedIdentifier< Tag, CaseSensitive >::operator= ( const TaggedIdentifier< Tag2, b > &  )
delete

Copy prohibited for other Tag classes or case sensitivity.

◆ operator=() [3/4]

template<typename Tag , bool CaseSensitive = true>
TaggedIdentifier & TaggedIdentifier< Tag, CaseSensitive >::operator= ( TaggedIdentifier< Tag, CaseSensitive > &&  )
default

Move allowed only for the same Tag class and case sensitivity.

◆ operator=() [4/4]

template<typename Tag , bool CaseSensitive = true>
template<typename Tag2 , bool b>
TaggedIdentifier & TaggedIdentifier< Tag, CaseSensitive >::operator= ( TaggedIdentifier< Tag2, b > &&  )
delete

Move prohibited for other Tag classes or case sensitivity.


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