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