Skip to content

GuitarPrometheus::Parser::IScoreImporter

GuitarPrometheus::Parser::IScoreImporter

Abstract interface for importing a score from a file. More…

#include <IScoreImporter.h>

Inherited by GuitarPrometheus::Parser::GpFileParser, GuitarPrometheus::Parser::GpxFileParser, GuitarPrometheus::Parser::MusicXmlParser

Public Functions

Name
virtual~IScoreImporter() =default
virtual Resultimport(const std::filesystem::path & file) const =0
Parse a score file from disk.
virtual ResultimportMemory(const std::uint8_t * bytes, std::size_t size) const
Parse a score from raw bytes already in memory.

Detailed Description

class GuitarPrometheus::Parser::IScoreImporter;

Abstract interface for importing a score from a file.

One concrete implementation exists per supported input format (MusicXML, Guitar Pro 7 / 8, Guitar Pro 6). The dispatcher [ScoreImporter::importFile](/api-reference/classes/classguitarprometheus_1_1parser_1_1scoreimporter/#function-importfile) selects an implementation by file extension.

Implementations are stateless and cheap to construct — instantiate one per call rather than caching.

Public Functions Documentation

function ~IScoreImporter

virtual ~IScoreImporter() =default

function import

virtual Result import(
const std::filesystem::path & file
) const =0

Parse a score file from disk.

Parameters:

  • file Absolute path to the source file.

Return: A Result containing either a parsed Score or a list of errors. Warnings are collected separately and are not fatal.

Reimplemented by: GuitarPrometheus::Parser::GpFileParser::import, GuitarPrometheus::Parser::GpxFileParser::import, GuitarPrometheus::Parser::MusicXmlParser::import

function importMemory

virtual Result importMemory(
const std::uint8_t * bytes,
std::size_t size
) const

Parse a score from raw bytes already in memory.

Parameters:

  • bytes Raw source bytes. Format is determined by the concrete importer.
  • size Number of bytes in bytes.

Return: A Result containing either a parsed Score or a list of errors.

Reimplemented by: GuitarPrometheus::Parser::MusicXmlParser::importMemory

Default implementation writes the bytes to a temporary file and delegates to import(path) — importers that can read directly from memory should override this for performance. ProjectStore::materializeScore uses this to re-materialise a Score from a .gpproj’s embedded source payload without round-tripping through the user’s filesystem.


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