Line data Source code
1 : /*! 2 : * \file esys/repo/configfile.cpp 3 : * \brief 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2020 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/configfile.h" 20 : #include "esys/repo/configfileimpl.h" 21 : 22 : namespace esys::repo 23 : { 24 : 25 59 : ConfigFile::ConfigFile() 26 : { 27 59 : m_impl = std::make_unique<ConfigFileImpl>(this); 28 59 : } 29 : 30 118 : ConfigFile::~ConfigFile() = default; 31 : 32 0 : void ConfigFile::set_path(const std::string &path) 33 : { 34 0 : m_path = path; 35 0 : } 36 : 37 0 : const std::string &ConfigFile::get_path() const 38 : { 39 0 : return m_path; 40 : } 41 : 42 59 : void ConfigFile::set_config(std::shared_ptr<Config> config) 43 : { 44 59 : m_config = config; 45 59 : } 46 : 47 303 : std::shared_ptr<Config> ConfigFile::get_config() const 48 : { 49 303 : return m_config; 50 : } 51 : 52 37 : Result ConfigFile::open(const std::string &path) 53 : { 54 37 : return get_impl()->open(path); 55 : } 56 : 57 22 : Result ConfigFile::write(const std::string &path) 58 : { 59 22 : return get_impl()->write(path); 60 : } 61 : 62 59 : ConfigFileImpl *ConfigFile::get_impl() 63 : { 64 59 : return m_impl.get(); 65 : } 66 : 67 0 : const ConfigFileImpl *ConfigFile::get_impl() const 68 : { 69 0 : return m_impl.get(); 70 : } 71 : 72 : } // namespace esys::repo