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) 2025 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 : #include "engraving/dom/score.h"
24 : #include "engraving/engravingerrors.h"
25 : #include "io/file.h"
26 :
27 : #include "importtef.h"
28 : #include "tableditreader.h"
29 :
30 : using namespace mu::iex::tabledit;
31 : using namespace mu::engraving;
32 :
33 0 : muse::Ret TablEditReader::read(MasterScore* score, const muse::io::path_t& path, const Options&)
34 : {
35 0 : Err err = import(score, path);
36 0 : return make_ret(err, path);
37 : }
38 :
39 61 : Err TablEditReader::import(MasterScore* score, const muse::io::path_t& path, const Options&)
40 : {
41 61 : if (!fileSystem()->exists(path)) {
42 0 : return Err::FileNotFound;
43 : }
44 :
45 61 : muse::io::File file(path);
46 61 : if (!file.open(muse::io::IODevice::ReadOnly)) {
47 0 : return Err::FileOpenError;
48 : }
49 61 : TablEdit tablEdit{ &file, score };
50 61 : Err err = tablEdit.import();
51 :
52 61 : return err;
53 61 : }
|