LCOV - code coverage report
Current view: top level - src/esys/repo - userconfig.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 21 35 60.0 %
Date: 2026-08-01 10:43:40 Functions: 8 13 61.5 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/userconfig.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2023 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #include "esys/repo/esysrepo_prec.h"
      19             : #include "esys/repo/userconfig.h"
      20             : 
      21             : namespace esys::repo
      22             : {
      23             : 
      24          69 : UserConfig::UserConfig() = default;
      25             : 
      26         121 : UserConfig::~UserConfig() = default;
      27             : 
      28         195 : void UserConfig::set_temp_path(const std::string &temp_path)
      29             : {
      30         195 :     m_temp_path = temp_path;
      31         195 : }
      32             : 
      33           0 : const std::string &UserConfig::get_temp_path() const
      34             : {
      35           0 :     return m_temp_path;
      36             : }
      37             : 
      38         195 : void UserConfig::set_manifest_directories_path(const std::string &manifest_directories_path)
      39             : {
      40         195 :     m_manifest_directories_path = manifest_directories_path;
      41         195 : }
      42             : 
      43           0 : const std::string &UserConfig::get_manifest_directories_path() const
      44             : {
      45           0 :     return m_manifest_directories_path;
      46             : }
      47             : 
      48          52 : void UserConfig::set_manifest_directories(std::shared_ptr<manifest::Directories> manifest_directories)
      49             : {
      50          52 :     m_manifest_directories = manifest_directories;
      51          52 : }
      52             : 
      53         180 : std::shared_ptr<manifest::Directories> UserConfig::get_manifest_directories() const
      54             : {
      55         180 :     return m_manifest_directories;
      56             : }
      57             : 
      58         137 : void UserConfig::set_traces_path(const std::string &traces_path)
      59             : {
      60         137 :     m_traces_path = traces_path;
      61         137 : }
      62             : 
      63           0 : const std::string &UserConfig::get_traces_path() const
      64             : {
      65           0 :     return m_traces_path;
      66             : }
      67             : 
      68          58 : void UserConfig::clear()
      69             : {
      70          58 :     set_manifest_directories_path("");
      71          58 :     set_temp_path("");
      72             : 
      73          70 :     if (get_manifest_directories() != nullptr) get_manifest_directories()->clear();
      74          58 : }
      75             : 
      76           0 : bool UserConfig::operator==(const UserConfig &cfg) const
      77             : {
      78           0 :     if (get_manifest_directories_path() != cfg.get_manifest_directories_path()) return false;
      79           0 :     if (get_temp_path() != cfg.get_temp_path()) return false;
      80           0 :     if ((get_manifest_directories() == nullptr) && (cfg.get_manifest_directories() == nullptr)) return true;
      81           0 :     if ((get_manifest_directories() != nullptr) && (cfg.get_manifest_directories() != nullptr))
      82             :     {
      83           0 :         if (*get_manifest_directories() != *cfg.get_manifest_directories()) return false;
      84             :     }
      85             :     return true;
      86             : }
      87             : 
      88           0 : bool UserConfig::operator!=(const UserConfig &cfg) const
      89             : {
      90           0 :     return !operator==(cfg);
      91             : }
      92             : 
      93             : } // namespace esys::repo

Generated by: LCOV version 1.14