LCOV - code coverage report
Current view: top level - src/importexport/musicxml - musicxmlmodule.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 83.3 % 18 15
Test Date: 2026-11-05 04:07:02

            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 "musicxmlmodule.h"
      23              : 
      24              : #include "modularity/ioc.h"
      25              : 
      26              : #ifndef MUSICXML_NO_INTERNAL
      27              : #include "project/inotationreadersregister.h"
      28              : #include "internal/musicxmlreader.h"
      29              : #include "project/inotationwritersregister.h"
      30              : #include "internal/musicxmlwriter.h"
      31              : #include "internal/musicxmlwriter.h"
      32              : #include "internal/mxlwriter.h"
      33              : #include "internal/musicxmlconfiguration.h"
      34              : #endif
      35              : 
      36              : using namespace muse;
      37              : using namespace mu::iex::musicxml;
      38              : 
      39            3 : std::string MusicXmlModule::moduleName() const
      40              : {
      41            6 :     return "iex_musicxml";
      42              : }
      43              : 
      44            1 : void MusicXmlModule::registerExports()
      45              : {
      46              : #ifndef MUSICXML_NO_INTERNAL
      47            1 :     m_configuration = std::make_shared<MusicXmlConfiguration>();
      48            1 :     globalIoc()->registerExport<IMusicXmlConfiguration>(moduleName(), m_configuration);
      49              : #endif
      50            1 : }
      51              : 
      52            1 : void MusicXmlModule::resolveImports()
      53              : {
      54              : #ifndef MUSICXML_NO_INTERNAL
      55              :     using namespace mu::project;
      56              : 
      57            1 :     auto readers = globalIoc()->resolve<INotationReadersRegister>(moduleName());
      58            1 :     if (readers) {
      59            0 :         readers->reg({ "xml", "musicxml", "mxl" }, std::make_shared<MusicXmlReader>());
      60              :     }
      61              : 
      62            1 :     auto writers = globalIoc()->resolve<INotationWritersRegister>(moduleName());
      63            1 :     if (writers) {
      64            0 :         writers->reg({ "musicxml", "xml" }, std::make_shared<MusicXmlWriter>());
      65            0 :         writers->reg({ "mxl" }, std::make_shared<MxlWriter>());
      66              :     }
      67              : #endif
      68            1 : }
      69              : 
      70            1 : void MusicXmlModule::onInit(const IApplication::RunMode&)
      71              : {
      72              : #ifndef MUSICXML_NO_INTERNAL
      73            1 :     m_configuration->init();
      74              : #endif
      75            1 : }
        

Generated by: LCOV version 2.0-1