Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #pragma once
24 :
25 : #include <map>
26 :
27 : #include "global/types/ret.h"
28 : #include "global/types/val.h"
29 : #include "global/io/iodevice.h"
30 : #include "global/progress.h"
31 : #include "notation/inotation_fwd.h"
32 :
33 : namespace mu::project {
34 : class INotationWriter
35 : {
36 : public:
37 :
38 93 : virtual ~INotationWriter() = default;
39 :
40 : enum class UnitType {
41 : PER_PAGE,
42 : PER_PART,
43 : MULTI_PART
44 : };
45 :
46 : enum class OptionKey {
47 : UNIT_TYPE,
48 : PAGE_NUMBER,
49 : TRANSPARENT_BACKGROUND,
50 : BEATS_COLORS,
51 : WAIT_FOR_COMPLETION,
52 :
53 : WITH_AUDIO,
54 :
55 : LEADING_SILENCE_SEC,
56 : TRAILING_SILENCE_SEC,
57 : };
58 :
59 : using Options = std::map<OptionKey, muse::Val>;
60 :
61 : virtual std::vector<UnitType> supportedUnitTypes() const = 0;
62 : virtual bool supportsUnitType(UnitType unitType) const = 0;
63 :
64 : virtual muse::Ret write(notation::INotationPtr notation, muse::io::IODevice& device, const Options& options = Options()) = 0;
65 : virtual muse::Ret writeList(const notation::INotationPtrList& notations, muse::io::IODevice& device,
66 : const Options& options = Options()) = 0;
67 :
68 0 : virtual muse::Progress* progress() { return nullptr; }
69 0 : virtual void abort() {}
70 : };
71 :
72 : using INotationWriterPtr = std::shared_ptr<INotationWriter>;
73 : }
|