GuitarPrometheus::Project::ProjectSerializer
GuitarPrometheus::Project::ProjectSerializer
Pure JSON / gzip / base64 boundary helpers. More…
Functions
| Name | |
|---|---|
| nlohmann::ordered_json | toJson(const ::GuitarPrometheus::Project::Project & project) |
| std::optional<::GuitarPrometheus::Project::Project > | fromJson(const nlohmann::json & parsed, std::vector< ProjectIssue > & issues) Inverse of toJson. |
| juce::MemoryBlock | compressXml(std::string_view rawXml) Compress a raw UTF-8 MusicXML string with gzip and return the resulting bytes. |
| std::string | decompressMusicXml(const juce::MemoryBlock & gzip) Decompress a gzip block back to UTF-8 MusicXML. |
| nlohmann::ordered_json | toJson(const Project & project) Serialize a Project to a JSON object. |
Attributes
| Name | |
|---|---|
| constexpr std::int64_t | kMaxProjectEmbeddedSize |
Detailed Description
Pure JSON / gzip / base64 boundary helpers.
No filesystem I/O. Callers (ProjectStore) wrap these in atomic-write / read-from-path / schema-validation logic.
Functions Documentation
function toJson
nlohmann::ordered_json toJson( const ::GuitarPrometheus::Project::Project & project)function fromJson
std::optional<::GuitarPrometheus::Project::Project > fromJson( const nlohmann::json & parsed, std::vector< ProjectIssue > & issues)Inverse of toJson.
Performs structural checks (required fields, base64-decode, gzip-decompress sanity) but not full JSON Schema validation — that’s the validator’s job. Returns nullopt on unrecoverable issues; pushes [ProjectIssue](/api-reference/classes/structguitarprometheus_1_1project_1_1projectissue/) entries describing each problem.
function compressXml
juce::MemoryBlock compressXml( std::string_view rawXml)Compress a raw UTF-8 MusicXML string with gzip and return the resulting bytes.
Used at New Project time when embedding a fresh .musicxml file.
function decompressMusicXml
std::string decompressMusicXml( const juce::MemoryBlock & gzip)Decompress a gzip block back to UTF-8 MusicXML.
Returns the empty string on any decompression failure; in normal operation a Project’s gzip block should always decompress successfully.
function toJson
nlohmann::ordered_json toJson( const Project & project)Serialize a Project to a JSON object.
The MusicXML payload is base64-encoded from its raw gzip bytes; the returned JSON is suitable for nlohmann::json::dump followed by atomic write.
Attributes Documentation
variable kMaxProjectEmbeddedSize
constexpr std::int64_t kMaxProjectEmbeddedSize = 64ll * 1024ll * 1024ll;Updated on 2026-05-29 at 07:39:52 +0000