LCOV - code coverage report
Current view: top level - src/esys/repo - config.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 56 73 76.7 %
Date: 2026-09-26 15:38:18 Functions: 21 25 84.0 %

          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         107 : Config::Config() = default;
      25             : 
      26         107 : Config::~Config() = default;
      27             : 
      28          98 : void Config::set_manifest_type(manifest::Type manifest_type)
      29             : {
      30          98 :     m_manifest_type = manifest_type;
      31          98 : }
      32             : 
      33         211 : manifest::Type Config::get_manifest_type() const
      34             : {
      35         211 :     return m_manifest_type;
      36             : }
      37             : 
      38          81 : void Config::set_manifest_kind(manifest::Kind manifest_kind)
      39             : {
      40          81 :     m_manifest_kind = manifest_kind;
      41          81 : }
      42             : 
      43          41 : manifest::Kind Config::get_manifest_kind() const
      44             : {
      45          41 :     return m_manifest_kind;
      46             : }
      47             : 
      48         106 : void Config::set_manifest_format(manifest::Format manifest_format)
      49             : {
      50         106 :     m_manifest_format = manifest_format;
      51         106 : }
      52             : 
      53          40 : manifest::Format Config::get_manifest_format() const
      54             : {
      55          40 :     return m_manifest_format;
      56             : }
      57             : 
      58          98 : void Config::set_manifest_path(const std::string &manifest_path)
      59             : {
      60          98 :     m_manifest_path = manifest_path;
      61          98 : }
      62             : 
      63         175 : const std::string &Config::get_manifest_path() const
      64             : {
      65         175 :     return m_manifest_path;
      66             : }
      67             : 
      68          90 : void Config::set_manifest_url(const std::string &manifest_url)
      69             : {
      70          90 :     m_manifest_url = manifest_url;
      71          90 : }
      72             : 
      73          78 : const std::string &Config::get_manifest_url() const
      74             : {
      75          78 :     return m_manifest_url;
      76             : }
      77             : 
      78           8 : void Config::set_manifest_local(const std::string &manifest_local)
      79             : {
      80           8 :     m_manifest_local = manifest_local;
      81           8 : }
      82             : 
      83          73 : const std::string &Config::get_manifest_local() const
      84             : {
      85          73 :     return m_manifest_local;
      86             : }
      87             : 
      88           2 : void Config::set_revision_set(const std::string &revision_set)
      89             : {
      90           2 :     m_revision_set = revision_set;
      91           2 : }
      92             : 
      93          68 : const std::string &Config::get_revision_set() const
      94             : {
      95          68 :     return m_revision_set;
      96             : }
      97             : 
      98          11 : void Config::set_prefer_branch(const std::string &prefer_branch)
      99             : {
     100          11 :     m_prefer_branch = prefer_branch;
     101          11 : }
     102             : 
     103          72 : const std::string &Config::get_prefer_branch() const
     104             : {
     105          72 :     return m_prefer_branch;
     106             : }
     107             : 
     108          90 : void Config::set_parse_mode(manifest::ParseMode mode)
     109             : {
     110          90 :     m_parse_mode = mode;
     111          90 : }
     112             : 
     113          89 : manifest::ParseMode Config::get_parse_mode() const
     114             : {
     115          89 :     return m_parse_mode;
     116             : }
     117             : 
     118           1 : bool Config::operator==(const Config &cfg) const
     119             : {
     120           1 :     if (get_manifest_type() != cfg.get_manifest_type()) return false;
     121           1 :     if (get_manifest_path() != cfg.get_manifest_path()) return false;
     122           1 :     if (get_manifest_format() != cfg.get_manifest_format()) return false;
     123           1 :     if (get_manifest_url() != cfg.get_manifest_url()) return false;
     124           1 :     if (get_manifest_local() != cfg.get_manifest_local()) return false;
     125           1 :     if (get_revision_set() != cfg.get_revision_set()) return false;
     126           1 :     if (get_prefer_branch() != cfg.get_prefer_branch()) return false;
     127           1 :     if (get_parse_mode() != cfg.get_parse_mode()) return false;
     128             : 
     129             :     return true;
     130             : }
     131             : 
     132           0 : bool Config::operator!=(const Config &cfg) const
     133             : {
     134           0 :     return !operator==(cfg);
     135             : }
     136             : 
     137           0 : Config &Config::operator=(const Config &cfg)
     138             : {
     139           0 :     if (cfg == *this) return *this;
     140             : 
     141           0 :     set_manifest_type(cfg.get_manifest_type());
     142           0 :     set_manifest_path(cfg.get_manifest_path());
     143           0 :     set_manifest_format(cfg.get_manifest_format());
     144           0 :     set_manifest_url(cfg.get_manifest_url());
     145           0 :     set_manifest_local(cfg.get_manifest_local());
     146           0 :     set_revision_set(cfg.get_revision_set());
     147           0 :     set_prefer_branch(cfg.get_prefer_branch());
     148           0 :     set_parse_mode(cfg.get_parse_mode());
     149             : 
     150           0 :     return *this;
     151             : }
     152             : 
     153           0 : bool Config::has_esysrepo_folder() const
     154             : {
     155           0 :     if ((get_manifest_type() == manifest::Type::GOOGLE_MANIFEST)
     156           0 :         || (get_manifest_type() == manifest::Type::ESYSREPO_MANIFEST))
     157           0 :         return true;
     158             :     return false;
     159             : }
     160             : 
     161             : } // namespace esys::repo

Generated by: LCOV version 1.14