denigma 4.0.0
Loading...
Searching...
No Matches
mss.h
1/*
2 * Copyright (C) 2026, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17 * THE SOFTWARE.
18 */
19#pragma once
20
21#include <optional>
22#include <string>
23
24#include "denigma/conversion.h"
25
26namespace denigma {
27namespace formats {
28
31namespace mss {
32
35struct Options final : public IOptions
36{
40 bool allPartsAndScore{ false };
42 std::optional<std::string> partName;
43};
44
48{
49public:
50 [[nodiscard]] FormatId sourceFormat() const override { return FormatId::EnigmaXml; }
51 [[nodiscard]] FormatId targetFormat() const override { return FormatId::MssXml; }
52
54 ConversionResult convert(std::span<const std::byte> input,
55 const MultiOutputCallback& outputCallback,
56 const Options& options = {}) const;
57
59 ConversionResult convert(std::span<const std::byte> input,
60 const MultiOutputCallback& outputCallback,
61 const ConversionRequest& request = {}) const override;
62};
63
67{
68public:
69 [[nodiscard]] FormatId sourceFormat() const override { return FormatId::Musx; }
70 [[nodiscard]] FormatId targetFormat() const override { return FormatId::MssXml; }
71
74 const MultiOutputCallback& outputCallback,
75 const Options& options = {}) const;
76
79 const MultiOutputCallback& outputCallback,
80 const ConversionRequest& request = {}) const override;
81};
82
85
86} // namespace mss
87} // namespace formats
88} // namespace denigma
Result metadata returned after a conversion completes.
Definition conversion.h:109
Lightweight registry for locating converters by source and target format.
Definition conversion.h:241
Public interface implemented by adapters that may produce multiple output documents.
Definition conversion.h:205
Base class for adapter-specific option structs.
Definition conversion.h:93
Random-access byte reader used for container formats such as MUSX.
Definition random_access_reader.h:32
Public interface implemented by reader-backed adapters that may produce multiple output documents.
Definition conversion.h:223
Converter adapter for Enigma XML input to one or more MuseScore style XML outputs.
Definition mss.h:48
ConversionResult convert(std::span< const std::byte > input, const MultiOutputCallback &outputCallback, const Options &options={}) const
Converts Enigma XML from memory and invokes outputCallback for each MSS document.
ConversionResult convert(std::span< const std::byte > input, const MultiOutputCallback &outputCallback, const ConversionRequest &request={}) const override
Converts Enigma XML using type-erased registry options.
FormatId targetFormat() const override
Returns the target format produced by this converter.
Definition mss.h:51
FormatId sourceFormat() const override
Returns the source format accepted by this converter.
Definition mss.h:50
Converter adapter for MUSX archive input to one or more MuseScore style XML outputs.
Definition mss.h:67
FormatId targetFormat() const override
Returns the target format produced by this converter.
Definition mss.h:70
ConversionResult convert(const IRandomAccessReader &input, const MultiOutputCallback &outputCallback, const Options &options={}) const
Extracts a MUSX archive and invokes outputCallback for each MSS document.
FormatId sourceFormat() const override
Returns the source format accepted by this converter.
Definition mss.h:69
ConversionResult convert(const IRandomAccessReader &input, const MultiOutputCallback &outputCallback, const ConversionRequest &request={}) const override
Extracts a MUSX archive using type-erased registry options.
void registerConverters(ConverterRegistry &registry)
Registers all MSS format converters with the supplied registry.
Core public API for the Denigma conversion libraries.
Definition articulations.h:32
FormatId
Stable identifiers for converter input and output formats.
Definition conversion.h:45
@ MssXml
MuseScore style sheet XML.
@ EnigmaXml
Finale Enigma XML.
@ Musx
Finale MUSX archive.
std::function< void(std::string_view suggestedName, std::span< const std::byte > data)> MultiOutputCallback
Callback used by converters that may emit zero, one, or many output buffers.
Definition conversion.h:200
Options common to all public converter adapters.
Definition conversion.h:75
Type-erased request used by registry-based converter calls.
Definition conversion.h:101
Options for MuseScore style XML converters.
Definition mss.h:36
bool allPartsAndScore
Emit the score plus all linked parts for multi-output conversion.
Definition mss.h:40
CommonOptions common
Options common to all converters.
Definition mss.h:38
std::optional< std::string > partName
Optional part-name prefix for multi-output conversion.
Definition mss.h:42