31#include "Fundamentals.h"
67 using VectorType = std::vector<MusxInstance<T>>;
72 : m_document(document), m_partId(partId) {}
80 auto document = m_document.lock();
81 MUSX_ASSERT_IF(!document) {
82 throw std::logic_error(
"Document pointer is no longer valid.");
88 std::weak_ptr<Document> m_document;
132 std::optional<size_t> getIndexForStaff(
StaffCmper staffId)
const;
149 bool iterateEntries(
size_t startIndex,
size_t endIndex,
const MusicRange& range, std::function<
bool(
const EntryInfoPtr&)> iterator)
const;
180 static_assert(!std::is_reference_v<T>,
"T must not be a reference");
181 using OwnedT = std::remove_const_t<T>;
202 const T&
emplace(OwnedT&& value)
noexcept(std::is_nothrow_move_constructible_v<OwnedT>) {
203 m_owned.emplace(std::move(value));
204 m_ref = std::addressof(*m_owned);
209 explicit operator bool() const noexcept {
return m_ref !=
nullptr; }
213 const T&
get() const noexcept {
return *m_ref; }
222 std::optional<OwnedT> m_owned{};
223 const T* m_ref =
nullptr;
226#ifndef DOXYGEN_SHOULD_IGNORE_THIS
235template<
class T> DeferredReference(
const T&) -> DeferredReference<T>;
236template<
class T> DeferredReference(
const T*) -> DeferredReference<T>;
Wraps a reference to an existing object or owns a temporary value if needed.
Definition MusxInstance.h:179
DeferredReference(const T *ptr) noexcept
Constructs a non-owning DeferredReference bound to a pointer.
Definition MusxInstance.h:193
DeferredReference() noexcept=default
Constructs an empty DeferredReference with no bound reference.
const T & emplace(OwnedT &&value) noexcept(std::is_nothrow_move_constructible_v< OwnedT >)
Moves a value into owned storage and binds to it.
Definition MusxInstance.h:202
const T * operator->() const noexcept
Provides pointer-like access to the referenced or owned object.
Definition MusxInstance.h:216
const T & operator*() const noexcept
Dereferences to the referenced or owned object.
Definition MusxInstance.h:219
const T & get() const noexcept
Gets a const reference to the referenced or owned object.
Definition MusxInstance.h:213
Represents a document object that encapsulates the entire EnigmaXML structure.
Definition Document.h:68
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:420
Utility class that represents of a range of musical time.
Definition CommonClasses.h:474
A container of pooled shared object instances from an ObjectPool.
Definition MusxInstance.h:66
MusxInstanceListBase(const std::weak_ptr< Document > &document, Cmper partId)
Default constructor.
Definition MusxInstance.h:71
Cmper getRequestedPartId() const
Gets the part id that was used to create this list.
Definition MusxInstance.h:75
std::shared_ptr< Document > getDocument() const
Gets the document that was used to create this list.
Definition MusxInstance.h:78
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:103
An array of StaffUsed defines a set of staves in a staff system or in Scroll View.
Definition Others.h:2712
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:39
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
std::weak_ptr< const T > MusxInstanceWeak
Defines a weak ptr to the type of a musx instance stored in a pool.
Definition MusxInstance.h:44
object model for musx file (enigmaxml)
Definition BaseClasses.h:36