Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::project::ProjectLoader Class Reference

Handles loading of Zrythm projects from disk. More...

#include <src/structure/project/project_loader.h>

Data Structures

struct  LoadResult
 Result of a project load operation. More...

Static Public Member Functions

static LoadResult load_from_directory (const fs::path &project_dir)
 Loads and validates a project from the specified directory.
static std::string get_uncompressed_project_text (const fs::path &project_dir)
 Reads and decompresses the project file.
static nlohmann::json parse_and_validate (const std::string &json_str)
 Parses JSON string and validates against schema.
static utils::Utf8String extract_title (const nlohmann::json &j)
 Extracts the project title from JSON metadata.

Detailed Description

Handles loading of Zrythm projects from disk.

This class manages the complete project loading pipeline:

  1. Reading compressed project file
  2. Zstd decompression
  3. JSON parsing
  4. Schema validation
  5. Metadata extraction

Definition at line 26 of file project_loader.h.

Member Function Documentation

◆ extract_title()

utils::Utf8String zrythm::structure::project::ProjectLoader::extract_title ( const nlohmann::json & j)
static

Extracts the project title from JSON metadata.

Parameters
jThe validated JSON object.
Returns
The project title, or "Untitled" if not found.

◆ get_uncompressed_project_text()

std::string zrythm::structure::project::ProjectLoader::get_uncompressed_project_text ( const fs::path & project_dir)
static

Reads and decompresses the project file.

Parameters
project_dirThe project directory.
Returns
The decompressed JSON string.
Exceptions
ZrythmExceptionif reading or decompression fails.

◆ load_from_directory()

LoadResult zrythm::structure::project::ProjectLoader::load_from_directory ( const fs::path & project_dir)
static

Loads and validates a project from the specified directory.

Parameters
project_dirThe project directory containing project.zpj
Returns
LoadResult containing the parsed JSON and metadata.
Exceptions
ZrythmExceptionif loading fails.

◆ parse_and_validate()

nlohmann::json zrythm::structure::project::ProjectLoader::parse_and_validate ( const std::string & json_str)
static

Parses JSON string and validates against schema.

Parameters
json_strThe raw JSON string.
Returns
Parsed and validated JSON object.
Exceptions
ZrythmExceptionif parsing or validation fails.

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