Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::utils Namespace Reference

String utilities. More...

Namespaces

namespace  compression
 Compression utilities.
 
namespace  exceptions
 Exception handling utilities.
 
namespace  math
 Math utils.
 

Data Structures

class  Backtrace
 
class  Color
 
class  ConstBidirectionalMap
 A read-only bidirectional map that maintains key-value and value-key mappings. More...
 
class  CStringRAII
 C string RAII wrapper. More...
 
class  FilePathList
 
class  ILogger
 
class  InitializableObject
 A factory class for creating initializable objects using static polymorphism. More...
 
class  Logger
 
class  LoggerProvider
 
class  MonotonicTimeProvider
 
class  OwningObjectRegistry
 A registry that owns and manages objects identified by a UUID. More...
 
class  QElapsedTimeProvider
 
class  QObjectUniquePtr
 A unique pointer for QObject objects that also works with QObject-based ownership. More...
 
class  TestLogger
 
class  Utf8String
 Lightweight UTF-8 string wrapper with safe conversions. More...
 
class  UuidIdentifiableObject
 Base class for objects that need to be uniquely identified by UUID. More...
 
class  UuidIdentifiableObjectSelectionManager
 
class  UuidIdentifiableObjectView
 A unified view over UUID-identified objects that supports: More...
 
class  UuidReference
 A reference-counted RAII wrapper for a UUID in a registry. More...
 

Concepts

concept  CloneableObject
 Concept that checks if a type is cloneable.
 
concept  CloneableDefaultInitializableObject
 Concept that checks if a type is cloneable.
 
concept  InheritsFromBase
 Concept to check if a type inherits from a base class.
 
concept  AllInheritFromBase
 Concept to ensure all types in a variant inherit from a base class.
 
concept  Initializable
 
concept  QObjectDerived
 
concept  UuidIdentifiable
 
concept  UuidIdentifiableQObject
 

Typedefs

using MonotonicTime = qint64
 
template<typename ReturnType, typename UuidType>
using UuidIdentifiablObjectResolver
 

Enumerations

enum class  ObjectCloneType { Snapshot , NewIdentity }
 
enum class  NoteLength {
  Bar , Beat , Note_2_1 , Note_1_1 ,
  Note_1_2 , Note_1_4 , Note_1_8 , Note_1_16 ,
  Note_1_32 , Note_1_64 , Note_1_128
}
 
enum class  NoteType { Normal , Dotted , Triplet }
 

Functions

template<CloneableObject Derived, typename... Args>
std::unique_ptr< Derived > clone_unique (const Derived &obj, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args)
 
template<CloneableObject Derived, typename... Args>
std::shared_ptr< Derived > clone_shared (const Derived &obj, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args)
 
template<CloneableObject Derived, typename... Args>
Derived * clone_raw_ptr (const Derived &obj, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args)
 
template<CloneableObject Derived, typename... Args>
requires utils::QObjectDerived<Derived>
Derived * clone_qobject (const Derived &obj, QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args)
 
template<CloneableObject Derived, typename... Args>
requires utils::QObjectDerived<Derived>
utils::QObjectUniquePtr< Derived > clone_unique_qobject (const Derived &obj, QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args)
 
template<typename T, std::size_t N>
void clone_unique_ptr_array (std::array< std::unique_ptr< T >, N > &dest, const std::array< std::unique_ptr< T >, N > &src, ObjectCloneType clone_type=ObjectCloneType::Snapshot)
 Clones the elements of a std::array of std::unique_ptr into the destination array.
 
template<typename T, template< typename... > class Ptr>
void clone_ptr_vector (std::vector< Ptr< T > > &dest, const std::vector< Ptr< T > > &src, ObjectCloneType clone_type=ObjectCloneType::Snapshot)
 Clones the elements of a std::vector of std::unique_ptr or std::shared_ptr into the destination vector.
 
template<typename Container>
void clone_unique_ptr_container (Container &dest, const Container &src, ObjectCloneType clone_type=ObjectCloneType::Snapshot)
 Clones the elements of a container of std::unique_ptr into the destination container.
 
template<typename Container, typename Variant, typename Base>
requires AllInheritFromBase<Variant, Base>
void clone_variant_container (Container &dest, const Container &src, ObjectCloneType clone_type=ObjectCloneType::Snapshot)
 
template<typename Variant, typename Container>
requires AllInheritFromBase<Variant, typename Container::value_type::element_type>
void clone_variant_container (Container &dest, const Container &src, ObjectCloneType clone_type=ObjectCloneType::Snapshot)
 Clones a container of variants.
 
std::string_view note_length_to_str (NoteLength len)
 
std::string_view note_type_to_str (NoteType type)
 
template<typename T, typename... Args>
QObjectUniquePtr< T > make_qobject_unique (Args &&... args)
 

Detailed Description

String utilities.

Typedef Documentation

◆ MonotonicTime

using zrythm::utils::MonotonicTime = qint64

Definition at line 10 of file monotonic_time_provider.h.

◆ UuidIdentifiablObjectResolver

template<typename ReturnType, typename UuidType>
using zrythm::utils::UuidIdentifiablObjectResolver
Initial value:
std::function<ReturnType (const UuidType &)>

Definition at line 256 of file uuid_identifiable_object.h.

Enumeration Type Documentation

◆ NoteLength

enum class zrythm::utils::NoteLength
strong

Definition at line 12 of file note_type.h.

◆ NoteType

enum class zrythm::utils::NoteType
strong
Enumerator
Dotted 

2/3 of its original size

Triplet 

3/2 of its original size

Definition at line 27 of file note_type.h.

◆ ObjectCloneType

enum class zrythm::utils::ObjectCloneType
strong
Enumerator
Snapshot 

Creates a snapshot of the object with the same identity.

NewIdentity 

Creates a separately identified object.

To be used only when duplicating objects as part of a user action.

Definition at line 19 of file icloneable.h.

Function Documentation

◆ clone_ptr_vector()

template<typename T, template< typename... > class Ptr>
void zrythm::utils::clone_ptr_vector ( std::vector< Ptr< T > > & dest,
const std::vector< Ptr< T > > & src,
ObjectCloneType clone_type = ObjectCloneType::Snapshot )

Clones the elements of a std::vector of std::unique_ptr or std::shared_ptr into the destination vector.

Template Parameters
TThe type of the elements in the vector.
PtrThe pointer type (std::unique_ptr or std::shared_ptr).
Parameters
destThe destination vector to clone into.
srcThe source vector to clone from.

Definition at line 200 of file icloneable.h.

◆ clone_qobject()

template<CloneableObject Derived, typename... Args>
requires utils::QObjectDerived<Derived>
Derived * zrythm::utils::clone_qobject ( const Derived & obj,
QObject * parent,
ObjectCloneType clone_type = ObjectCloneType::Snapshot,
Args &&... args )

Definition at line 104 of file icloneable.h.

◆ clone_raw_ptr()

template<CloneableObject Derived, typename... Args>
Derived * zrythm::utils::clone_raw_ptr ( const Derived & obj,
ObjectCloneType clone_type = ObjectCloneType::Snapshot,
Args &&... args )

Definition at line 93 of file icloneable.h.

◆ clone_shared()

template<CloneableObject Derived, typename... Args>
std::shared_ptr< Derived > zrythm::utils::clone_shared ( const Derived & obj,
ObjectCloneType clone_type = ObjectCloneType::Snapshot,
Args &&... args )

Definition at line 69 of file icloneable.h.

◆ clone_unique()

template<CloneableObject Derived, typename... Args>
std::unique_ptr< Derived > zrythm::utils::clone_unique ( const Derived & obj,
ObjectCloneType clone_type = ObjectCloneType::Snapshot,
Args &&... args )

Definition at line 46 of file icloneable.h.

◆ clone_unique_ptr_array()

template<typename T, std::size_t N>
void zrythm::utils::clone_unique_ptr_array ( std::array< std::unique_ptr< T >, N > & dest,
const std::array< std::unique_ptr< T >, N > & src,
ObjectCloneType clone_type = ObjectCloneType::Snapshot )

Clones the elements of a std::array of std::unique_ptr into the destination array.

Template Parameters
TThe type of the elements in the array.
NThe size of the array.
Parameters
destThe destination array to clone into.
srcThe source array to clone from.

Definition at line 164 of file icloneable.h.

◆ clone_unique_ptr_container()

template<typename Container>
void zrythm::utils::clone_unique_ptr_container ( Container & dest,
const Container & src,
ObjectCloneType clone_type = ObjectCloneType::Snapshot )

Clones the elements of a container of std::unique_ptr into the destination container.

Template Parameters
ContainerThe type of the container.
Parameters
destThe destination container to clone into.
srcThe source container to clone from.

Definition at line 253 of file icloneable.h.

◆ clone_unique_qobject()

template<CloneableObject Derived, typename... Args>
requires utils::QObjectDerived<Derived>
utils::QObjectUniquePtr< Derived > zrythm::utils::clone_unique_qobject ( const Derived & obj,
QObject * parent,
ObjectCloneType clone_type = ObjectCloneType::Snapshot,
Args &&... args )

Definition at line 121 of file icloneable.h.

◆ clone_variant_container() [1/2]

template<typename Container, typename Variant, typename Base>
requires AllInheritFromBase<Variant, Base>
void zrythm::utils::clone_variant_container ( Container & dest,
const Container & src,
ObjectCloneType clone_type = ObjectCloneType::Snapshot )

Definition at line 271 of file icloneable.h.

◆ clone_variant_container() [2/2]

template<typename Variant, typename Container>
requires AllInheritFromBase<Variant, typename Container::value_type::element_type>
void zrythm::utils::clone_variant_container ( Container & dest,
const Container & src,
ObjectCloneType clone_type = ObjectCloneType::Snapshot )

Clones a container of variants.

Template Parameters
VariantThe variant type containing possible derived classes.
ContainerThe container type (deduced automatically).

Definition at line 320 of file icloneable.h.

◆ make_qobject_unique()

template<typename T, typename... Args>
QObjectUniquePtr< T > zrythm::utils::make_qobject_unique ( Args &&... args)

Definition at line 79 of file qt.h.