Line data Source code
1 : /*! 2 : * \file esys/repo/sharing/occurrence_sharing.cpp 3 : * \brief Dependency occurrence (ADR-0042) 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2026 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/sharing/occurrence.h" 20 : 21 : namespace esys::repo::sharing 22 : { 23 : 24 9 : void Occurrence::set_consumer_path(const std::string &path) 25 : { 26 9 : m_consumer_path = path; 27 9 : } 28 : 29 5 : const std::string &Occurrence::get_consumer_path() const 30 : { 31 5 : return m_consumer_path; 32 : } 33 : 34 9 : void Occurrence::set_dependency_path(const std::string &path) 35 : { 36 9 : m_dependency_path = path; 37 9 : } 38 : 39 9 : const std::string &Occurrence::get_dependency_path() const 40 : { 41 9 : return m_dependency_path; 42 : } 43 : 44 9 : void Occurrence::set_declaration_kind(DeclarationKind kind) 45 : { 46 9 : m_declaration_kind = kind; 47 9 : } 48 : 49 3 : DeclarationKind Occurrence::get_declaration_kind() const 50 : { 51 3 : return m_declaration_kind; 52 : } 53 : 54 9 : void Occurrence::set_provenance(const std::string &text) 55 : { 56 9 : m_provenance = text; 57 9 : } 58 : 59 0 : const std::string &Occurrence::get_provenance() const 60 : { 61 0 : return m_provenance; 62 : } 63 : 64 9 : void Occurrence::set_original_url(const std::string &url) 65 : { 66 9 : m_original_url = url; 67 9 : } 68 : 69 0 : const std::string &Occurrence::get_original_url() const 70 : { 71 0 : return m_original_url; 72 : } 73 : 74 8 : void Occurrence::set_normalized_identity(const std::string &identity) 75 : { 76 8 : m_normalized_identity = identity; 77 8 : } 78 : 79 19 : const std::string &Occurrence::get_normalized_identity() const 80 : { 81 19 : return m_normalized_identity; 82 : } 83 : 84 8 : void Occurrence::set_required_revision(const std::string &rev) 85 : { 86 8 : m_required_revision = rev; 87 8 : } 88 : 89 0 : const std::string &Occurrence::get_required_revision() const 90 : { 91 0 : return m_required_revision; 92 : } 93 : 94 7 : void Occurrence::set_required_commit(const std::string &sha) 95 : { 96 7 : m_required_commit = sha; 97 7 : } 98 : 99 3 : const std::string &Occurrence::get_required_commit() const 100 : { 101 3 : return m_required_commit; 102 : } 103 : 104 1 : void Occurrence::set_matched_provider_path(const std::string &path) 105 : { 106 1 : m_matched_provider_path = path; 107 1 : } 108 : 109 2 : const std::string &Occurrence::get_matched_provider_path() const 110 : { 111 2 : return m_matched_provider_path; 112 : } 113 : 114 2 : void Occurrence::set_materialization_status(MaterializationStatus status) 115 : { 116 2 : m_materialization_status = status; 117 2 : } 118 : 119 4 : MaterializationStatus Occurrence::get_materialization_status() const 120 : { 121 4 : return m_materialization_status; 122 : } 123 : 124 1 : void Occurrence::set_error(const std::string &text) 125 : { 126 1 : m_error = text; 127 1 : } 128 : 129 1 : const std::string &Occurrence::get_error() const 130 : { 131 1 : return m_error; 132 : } 133 : 134 10 : std::string Occurrence::scope_key() const 135 : { 136 20 : return m_consumer_path + std::string(1, '\x1f') + m_dependency_path; 137 : } 138 : 139 : } // namespace esys::repo::sharing