LCOV - code coverage report
Current view: top level - src/esys/repo - config.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 32 45 71.1 %
Date: 2026-08-01 10:43:40 Functions: 13 17 76.5 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/config.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2020-2022 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/config.h"
      20             : 
      21             : namespace esys::repo
      22             : {
      23             : 
      24          63 : Config::Config() = default;
      25             : 
      26          63 : Config::~Config() = default;
      27             : 
      28          62 : void Config::set_manifest_type(manifest::Type manifest_type)
      29             : {
      30          62 :     m_manifest_type = manifest_type;
      31          62 : }
      32             : 
      33          95 : manifest::Type Config::get_manifest_type() const
      34             : {
      35          95 :     return m_manifest_type;
      36             : }
      37             : 
      38          50 : void Config::set_manifest_kind(manifest::Kind manifest_kind)
      39             : {
      40          50 :     m_manifest_kind = manifest_kind;
      41          50 : }
      42             : 
      43          22 : manifest::Kind Config::get_manifest_kind() const
      44             : {
      45          22 :     return m_manifest_kind;
      46             : }
      47             : 
      48          70 : void Config::set_manifest_format(manifest::Format manifest_format)
      49             : {
      50          70 :     m_manifest_format = manifest_format;
      51          70 : }
      52             : 
      53          24 : manifest::Format Config::get_manifest_format() const
      54             : {
      55          24 :     return m_manifest_format;
      56             : }
      57             : 
      58          62 : void Config::set_manifest_path(const std::string &manifest_path)
      59             : {
      60          62 :     m_manifest_path = manifest_path;
      61          62 : }
      62             : 
      63         120 : const std::string &Config::get_manifest_path() const
      64             : {
      65         120 :     return m_manifest_path;
      66             : }
      67             : 
      68          59 : void Config::set_manifest_url(const std::string &manifest_url)
      69             : {
      70          59 :     m_manifest_url = manifest_url;
      71          59 : }
      72             : 
      73          47 : const std::string &Config::get_manifest_url() const
      74             : {
      75          47 :     return m_manifest_url;
      76             : }
      77             : 
      78           1 : bool Config::operator==(const Config &cfg) const
      79             : {
      80           1 :     if (get_manifest_type() != cfg.get_manifest_type()) return false;
      81           1 :     if (get_manifest_path() != cfg.get_manifest_path()) return false;
      82           1 :     if (get_manifest_format() != cfg.get_manifest_format()) return false;
      83           1 :     if (get_manifest_url() != cfg.get_manifest_url()) return false;
      84             : 
      85             :     return true;
      86             : }
      87             : 
      88           0 : bool Config::operator!=(const Config &cfg) const
      89             : {
      90           0 :     return !operator==(cfg);
      91             : }
      92             : 
      93           0 : Config &Config::operator=(const Config &cfg)
      94             : {
      95           0 :     if (cfg == *this) return *this;
      96             : 
      97           0 :     set_manifest_type(cfg.get_manifest_type());
      98           0 :     set_manifest_path(cfg.get_manifest_path());
      99           0 :     set_manifest_format(cfg.get_manifest_format());
     100           0 :     set_manifest_url(cfg.get_manifest_url());
     101             : 
     102           0 :     return *this;
     103             : }
     104             : 
     105           0 : bool Config::has_esysrepo_folder() const
     106             : {
     107           0 :     if ((get_manifest_type() == manifest::Type::GOOGLE_MANIFEST)
     108           0 :         || (get_manifest_type() == manifest::Type::ESYSREPO_MANIFEST))
     109           0 :         return true;
     110             :     return false;
     111             : }
     112             : 
     113             : } // namespace esys::repo

Generated by: LCOV version 1.14