A lightweight reference that can hold either a ProjectItemID or a file path.
More...
#include <tracktion_ProjectItemRef.h>
A lightweight reference that can hold either a ProjectItemID or a file path.
The string value is auto-detected:
- If it parses as a valid ProjectItemID (hex/hex format), it's treated as an ID
- If it's an absolute file path, it's treated as such
- Otherwise it's treated as a relative path (resolved against a project folder)
◆ ProjectItemRef() [1/4]
| engine::ProjectItemRef::ProjectItemRef |
( |
| ) |
|
|
defaultnoexcept |
◆ ProjectItemRef() [2/4]
| engine::ProjectItemRef::ProjectItemRef |
( |
const juce::String & |
pathOrID | ) |
|
|
explicit |
Creates a ref from a string that is either a ProjectItemID or a file path.
◆ ProjectItemRef() [3/4]
| engine::ProjectItemRef::ProjectItemRef |
( |
const juce::String & |
pathOrID, |
|
|
Project & |
owner |
|
) |
| |
Creates a ref from a path string with a known owner project.
◆ ProjectItemRef() [4/4]
◆ fromPath() [1/2]
| static ProjectItemRef engine::ProjectItemRef::fromPath |
( |
const juce::String & |
relativePath | ) |
|
|
static |
Creates a ref from a relative path string.
◆ fromPath() [2/2]
| static ProjectItemRef engine::ProjectItemRef::fromPath |
( |
const juce::String & |
relativePath, |
|
|
Project & |
owner |
|
) |
| |
|
static |
Creates a ref from a relative path with a known owner project.
◆ fromAbsolutePath()
| static ProjectItemRef engine::ProjectItemRef::fromAbsolutePath |
( |
const juce::File & |
| ) |
|
|
static |
Creates a ref from an absolute file.
◆ isValid()
| bool engine::ProjectItemRef::isValid |
( |
| ) |
const |
|
noexcept |
◆ isProjectItemID()
| bool engine::ProjectItemRef::isProjectItemID |
( |
| ) |
const |
|
noexcept |
◆ isRelativePath()
| bool engine::ProjectItemRef::isRelativePath |
( |
| ) |
const |
|
noexcept |
◆ isAbsolutePath()
| bool engine::ProjectItemRef::isAbsolutePath |
( |
| ) |
const |
|
noexcept |
◆ getProjectID()
| ProjectID engine::ProjectItemRef::getProjectID |
( |
| ) |
const |
|
noexcept |
Returns the ID of the Project.
- See also
- Project::getProjectId.
◆ getProjectItemID()
| std::optional< ProjectItemID > engine::ProjectItemRef::getProjectItemID |
( |
| ) |
const |
|
noexcept |
Returns the ProjectItemID if this ref is ID-based, otherwise std::nullopt.
◆ toIDForFilename()
| juce::String engine::ProjectItemRef::toIDForFilename |
( |
| ) |
const |
|
noexcept |
Returns a string which can be used for filenames.
This isn't meant for resolution, it will be the ProjectItemID or a hash of path.
◆ toString()
| juce::String engine::ProjectItemRef::toString |
( |
| ) |
const |
|
noexcept |
Returns the raw string value.
◆ getProject()
| juce::ReferenceCountedObjectPtr< Project > engine::ProjectItemRef::getProject |
( |
| ) |
const |
|
noexcept |
Returns the owner project, if one was provided at construction.
◆ resolve()
| juce::File engine::ProjectItemRef::resolve |
( |
Engine & |
, |
|
|
const juce::File & |
projectFolder = {} |
|
) |
| const |
Resolves to a file.
- If ProjectItemID: looks up via engine's ProjectManager
- If relative path: resolves against the given folder, or the owner project's default directory if no folder is provided
- If absolute path: returns directly
◆ operator==() [1/2]
| bool engine::ProjectItemRef::operator== |
( |
const ProjectItemRef & |
| ) |
const |
◆ operator!=() [1/2]
| bool engine::ProjectItemRef::operator!= |
( |
const ProjectItemRef & |
| ) |
const |
◆ operator<()
| bool engine::ProjectItemRef::operator< |
( |
const ProjectItemRef & |
| ) |
const |
◆ operator==() [2/2]
◆ operator!=() [2/2]
The documentation for this class was generated from the following file: