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 : #include "rwregister.h"
23 :
24 : #include "types/constants.h"
25 :
26 : #include "read114/read114.h"
27 : #include "read206/read206.h"
28 : #include "read302/read302.h"
29 : #include "read400/read400.h"
30 : #include "read410/read410.h"
31 : #include "read460/read460.h"
32 : #include "read500/read500.h"
33 :
34 : #include "write/writer.h"
35 :
36 : using namespace mu::engraving;
37 : using namespace mu::engraving::rw;
38 :
39 1654 : IReaderPtr RWRegister::reader(int version)
40 : {
41 1654 : if (version < 0) {
42 635 : version = Constants::MSC_VERSION;
43 : }
44 :
45 1654 : if (version <= 114) {
46 26 : return std::make_shared<read114::Read114>();
47 1628 : } else if (version <= 207) {
48 33 : return std::make_shared<read206::Read206>();
49 1595 : } else if (version < 400) {
50 414 : return std::make_shared<read302::Read302>();
51 1181 : } else if (version < 410) {
52 73 : return std::make_shared<read400::Read400>();
53 1108 : } else if (version < 460) {
54 186 : return std::make_shared<read410::Read410>();
55 922 : } else if (version < 500) {
56 117 : return std::make_shared<read460::Read460>();
57 : }
58 :
59 805 : return std::make_shared<read500::Read500>();
60 : }
61 :
62 1938 : IWriterPtr RWRegister::writer()
63 : {
64 1938 : return std::make_shared<write::Writer>();
65 : }
|