This repository has been archived on 2020-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
FediPotato/lib/include/directories.hpp

90 lines
2.2 KiB
C++

/* This file is part of FediPotato.
* Copyright © 2020 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FEDIPOTATO_DIRECTORIES_HPP
#define FEDIPOTATO_DIRECTORIES_HPP
#if __has_include(<filesystem>)
# include <filesystem>
#else
# include <experimental/filesystem>
#endif
#include <string>
#include <string_view>
namespace FediPotato
{
using std::string;
using std::string_view;
namespace fs = std::filesystem;
/*!
* @brief Find the proper directories.
*
* @since 0.1.0
*
* @headerfile directories.hpp FediPotato/directories.hpp
*/
class Directories
{
public:
/*!
* @brief Construct a Directories object.
*
* @param application_name The name of your application. Is appended to
* all returned directories.
*
* @since 0.1.0
*/
explicit Directories(const string_view application_name)
: _application_name{application_name}
{}
//! Copy constructor
Directories(const Directories &other) = default;
//! Move constructor
Directories(Directories &&other) noexcept = default;
//! Destructor
virtual ~Directories() noexcept = default;
//! Copy assignment operator
Directories& operator=(const Directories &other) = delete;
//! Move assignment operator
Directories& operator=(Directories &&other) noexcept = delete;
public:
/*!
* @brief Return the directory for config files.
*
* @since 0.1.0
*/
[[nodiscard]]
fs::path config() const;
private:
const string _application_name;
};
} // namespace FediPotato
#endif // FEDIPOTATO_DIRECTORIES_HPP