LCOV - code coverage report
Current view: top level - muse/framework/global/modularity - imodulesetup.h Coverage Total Hit
Test: filtered_coverage.info Lines: 42.9 % 28 12
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2024 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              : #ifndef MU_MODULARITY_IMODULESETUP_H
      24              : #define MU_MODULARITY_IMODULESETUP_H
      25              : 
      26              : #include <string>
      27              : 
      28              : #include "ioc.h"
      29              : #include "../iapplication.h"
      30              : 
      31              : namespace muse::modularity {
      32              : class IContextSetup
      33              : {
      34              : public:
      35              : 
      36            0 :     IContextSetup(const modularity::ContextPtr& ctx)
      37            0 :         : m_ctx(ctx) {}
      38              : 
      39            0 :     virtual ~IContextSetup() = default;
      40              : 
      41            0 :     const modularity::ContextPtr iocContext() const { return m_ctx; }
      42            0 :     ModulesContextIoC* ioc() const { return modularity::ioc(iocContext()); }
      43              : 
      44            0 :     virtual void registerExports() {}
      45            0 :     virtual void resolveImports() {}
      46            0 :     virtual void onPreInit(const IApplication::RunMode& mode) { (void)mode; }
      47            0 :     virtual void onInit(const IApplication::RunMode& mode) { (void)mode; }
      48            0 :     virtual void onAllInited(const IApplication::RunMode& mode) { (void)mode; }
      49            0 :     virtual void onDelayedInit() {}
      50            0 :     virtual void onDeinit() {}
      51            0 :     virtual void onDestroy() {}
      52              : 
      53              : private:
      54              :     ContextPtr m_ctx;
      55              : };
      56              : 
      57              : class IModuleSetup
      58              : {
      59              : public:
      60              : 
      61           88 :     virtual ~IModuleSetup() {}
      62              : 
      63              :     virtual std::string moduleName() const = 0;
      64              : 
      65          704 :     ModulesGlobalIoC* globalIoc() const { return muse::modularity::globalIoc(); }
      66              : 
      67            2 :     virtual void registerExports() {}
      68           63 :     virtual void resolveImports() {}
      69              : 
      70           72 :     virtual void registerResources() {}
      71           72 :     virtual void registerUiTypes() {}
      72            0 :     virtual void registerApi() {}
      73              : 
      74           42 :     virtual void onPreInit(const IApplication::RunMode& mode) { (void)mode; }
      75            4 :     virtual void onInit(const IApplication::RunMode& mode) { (void)mode; }
      76           88 :     virtual void onAllInited(const IApplication::RunMode& mode) { (void)mode; }
      77            0 :     virtual void onDelayedInit() {}
      78           26 :     virtual void onDeinit() {}
      79           88 :     virtual void onDestroy() {}
      80              : 
      81           88 :     virtual void onStartApp() {}
      82              : 
      83              :     // Context
      84            0 :     virtual IContextSetup* newContext(const muse::modularity::ContextPtr& ctx) const { (void)ctx; return nullptr; }
      85              : };
      86              : }
      87              : 
      88              : #endif // MU_MODULARITY_IMODULESETUP_H
        

Generated by: LCOV version 2.0-1