Skip to content

GuitarPrometheus::Project::ProjectStore

GuitarPrometheus::Project::ProjectStore

Load / save .gpproj files. More…

#include <ProjectStore.h>

Public Classes

Name
structLoadResult
structMaterializeResult

Public Functions

Name
LoadResultload(const juce::File & path)
Load a project from disk.
voidsave(const Project & project, const juce::File & path)
Atomically write a project to disk.
juce::StringfilenameFor(const Project & project)
Stable filename for a Project: {slug(name)}-{6-char-hash}.gpproj.
MaterializeResultmaterializeScore(const Project & project)
Decompress the embedded MusicXML and run the parser.
juce::MemoryBlockcompressMusicXml(std::string_view rawXml)
Compress raw MusicXML to gzip bytes.
std::stringdecompressMusicXml(const Project & project)
Decompress a Project’s embedded MusicXML to a string.
std::stringdecompressMusicXmlBytes(const juce::MemoryBlock & gzip)
Decompress arbitrary gzip bytes to MusicXML text.

Detailed Description

class GuitarPrometheus::Project::ProjectStore;

Load / save .gpproj files.

Mirrors ProfileStore patterns (FNV-1a hash + slug filename, atomic write) but stores Projects at user-chosen paths rather than scanning a fixed directory — Projects are one per arrangement, not a shared library.

Public Functions Documentation

function load

static LoadResult load(
const juce::File & path
)

Load a project from disk.

Reads the file, parses JSON, structurally validates, and constructs the Project model. Issues describe any problems; on hard failure project is empty.

function save

static void save(
const Project & project,
const juce::File & path
)

Atomically write a project to disk.

Overwrites any existing file at path. The file is the JSON output of ProjectSerializer::toJson(project).

function filenameFor

static juce::String filenameFor(
const Project & project
)

Stable filename for a Project: {slug(name)}-{6-char-hash}.gpproj.

Used as a default when the user picks a destination directory without specifying a filename.

function materializeScore

static MaterializeResult materializeScore(
const Project & project
)

Decompress the embedded MusicXML and run the parser.

Heavyweight; split from load so unit tests can exercise project I/O without paying the parser cost.

function compressMusicXml

static juce::MemoryBlock compressMusicXml(
std::string_view rawXml
)

Compress raw MusicXML to gzip bytes.

Used at New-Project time to embed the source XML in a fresh Project. Public so the NewProjectFlow UI (and tests) can construct Projects without touching the private serializer.

function decompressMusicXml

static std::string decompressMusicXml(
const Project & project
)

Decompress a Project’s embedded MusicXML to a string.

The inverse of compressMusicXml. Returns empty string on decompression failure.

function decompressMusicXmlBytes

static std::string decompressMusicXmlBytes(
const juce::MemoryBlock & gzip
)

Decompress arbitrary gzip bytes to MusicXML text.

Used by F11.6’s load-time replay of merged sources, where the bytes don’t belong to the primary Project::musicXmlGzip. Returns empty string on decompression failure.


Updated on 2026-05-29 at 07:39:52 +0000