Line data Source code
1 : /*! 2 : * \file esys/repo/userconfigfile.h 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/userconfigfile.h" 20 : #include "esys/repo/userconfigfileimpl.h" 21 : 22 : namespace esys::repo 23 : { 24 : 25 58 : UserConfigFile::UserConfigFile() 26 : { 27 58 : m_impl = std::make_unique<UserConfigFileImpl>(this); 28 58 : } 29 : 30 116 : UserConfigFile::~UserConfigFile() = default; 31 : 32 0 : void UserConfigFile::set_path(const std::string &path) 33 : { 34 0 : m_path = path; 35 0 : } 36 : 37 0 : const std::string &UserConfigFile::get_path() const 38 : { 39 0 : return m_path; 40 : } 41 : 42 58 : void UserConfigFile::set_config(std::shared_ptr<UserConfig> user_config) 43 : { 44 58 : m_user_config = user_config; 45 58 : } 46 : 47 516 : std::shared_ptr<UserConfig> UserConfigFile::get_config() const 48 : { 49 516 : return m_user_config; 50 : } 51 : 52 58 : Result UserConfigFile::read(const std::string &path) 53 : { 54 58 : return get_impl()->read(path); 55 : } 56 : 57 0 : Result UserConfigFile::write(const std::string &path) 58 : { 59 0 : return get_impl()->write(path); 60 : } 61 : 62 58 : UserConfigFileImpl *UserConfigFile::get_impl() 63 : { 64 58 : return m_impl.get(); 65 : } 66 : 67 0 : const UserConfigFileImpl *UserConfigFile::get_impl() const 68 : { 69 0 : return m_impl.get(); 70 : } 71 : 72 : } // namespace esys::repo