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  AudioFileWriter
class  Backtrace
class  ConstBidirectionalMap
 A read-only bidirectional map that maintains key-value and value-key mappings. More...
class  Color
class  Debouncer
 Generic debouncer that delays execution of a callback until a specified time period has elapsed without the debounce being called again. More...
class  ExpandableTickRange
class  FilePathList
class  ILogger
class  Logger
class  TestLogger
class  LoggerProvider
class  MonotonicTimeProvider
class  QElapsedTimeProvider
class  PlaybackCacheScheduler
 Cache request handler for a tick range, with built-in debouncing and expanding of the range. More...
class  QObjectUniquePtr
 A unique pointer for QObject objects that also works with QObject-based ownership. More...
class  Utf8String
 Lightweight UTF-8 string wrapper with safe conversions. More...
class  CStringRAII
 C string RAII wrapper. More...
class  UuidIdentifiableObject
 Base class for objects that need to be uniquely identified by UUID. More...
class  UuidReference
 A reference-counted RAII wrapper for a UUID in a registry. More...
class  OwningObjectRegistry
 A registry that owns and manages objects identified by a UUID. More...
class  UuidIdentifiableObjectSelectionManager
class  UuidIdentifiableObjectView
 A unified view over UUID-identified objects that supports: 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  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

auto format_as (const ExpandableTickRange &range) -> std::string
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.
 Q_ENUM_NS (NoteLength)
std::string_view note_length_to_str (NoteLength len)
std::string_view note_type_to_str (NoteType type)
template<class T>
constexpr bool values_equal_for_qproperty_type (const T &a, const T &b)
 Helper that checks if 2 values are equal.
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 304 of file uuid_identifiable_object.h.

Enumeration Type Documentation

◆ NoteLength

enum class zrythm::utils::NoteLength
strong

Definition at line 14 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 30 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 18 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 178 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 82 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 71 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 58 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 45 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 142 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 231 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 99 of file icloneable.h.

◆ clone_variant_container() [1/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 298 of file icloneable.h.

◆ clone_variant_container() [2/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 249 of file icloneable.h.

◆ format_as()

auto zrythm::utils::format_as ( const ExpandableTickRange & range) ->std::string
inline

Definition at line 87 of file expandable_tick_range.h.

◆ make_qobject_unique()

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

Definition at line 103 of file qt.h.

◆ values_equal_for_qproperty_type()

template<class T>
bool zrythm::utils::values_equal_for_qproperty_type ( const T & a,
const T & b )
constexpr

Helper that checks if 2 values are equal.

This is intended used in QObject property setters.

Definition at line 20 of file qt.h.