SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
safe_filesystem_entry.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <cassert>
16#include <filesystem>
17#include <system_error>
18
20
21namespace seqan3::detail
22{
23
38{
39public:
48
53 {}
54
57 {
60
61 assert(!static_cast<bool>(ec));
62 }
64
73 bool remove()
74 {
76 }
77
79 bool remove_no_throw() const noexcept
80 {
83 }
84
95 {
97 }
98
99private:
102};
103
104} // namespace seqan3::detail
A safe guard to manage a filesystem entry, e.g. a file or a directory.
Definition: safe_filesystem_entry.hpp:38
safe_filesystem_entry()=delete
Deleted.
safe_filesystem_entry(safe_filesystem_entry &&)=default
Defaulted.
std::uintmax_t remove_all()
Removes a file or directory and all its contents, recursively.
Definition: safe_filesystem_entry.hpp:94
safe_filesystem_entry(safe_filesystem_entry const &)=delete
Deleted.
std::filesystem::path entry
The managed resource.
Definition: safe_filesystem_entry.hpp:101
bool remove()
Removes a file or empty directory.
Definition: safe_filesystem_entry.hpp:73
~safe_filesystem_entry()
Calls std::filesystem::remove_all on the wrapped entry.
Definition: safe_filesystem_entry.hpp:56
safe_filesystem_entry & operator=(safe_filesystem_entry const &)=delete
Deleted.
safe_filesystem_entry & operator=(safe_filesystem_entry &&)=default
Defaulted.
bool remove_no_throw() const noexcept
Removes a file or empty directory.
Definition: safe_filesystem_entry.hpp:79
safe_filesystem_entry(std::filesystem::path p)
Constructs the safe guard from a std::filesystem::path.
Definition: safe_filesystem_entry.hpp:52
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides platform and dependency checks.
T remove_all(T... args)