Horizon
tree_writer_archive.hpp
1 #pragma once
2 #include "tree_writer.hpp"
3 #include <sstream>
4 #include <set>
5 #include <optional>
6 #include <archive.h>
7 
8 namespace horizon {
9 class TreeWriterArchive : public TreeWriter {
10 public:
11  enum class Type { TGZ, ZIP };
12 
13  TreeWriterArchive(const fs::path &filename, Type type);
14 
16 
17 private:
18  std::ostream &create_file_internal(const fs::path &path) override;
19  void close_file() override;
20  void mkdir_recursive(const fs::path &path);
21 
22  const Type type;
23  std::optional<std::ostringstream> ostream;
24  std::set<fs::path> created_files;
25  std::set<fs::path> created_directories;
26 
27  archive *ar = nullptr;
28  archive_entry *ar_entry = nullptr;
29 };
30 } // namespace horizon
Definition: tree_writer_archive.hpp:9
Definition: tree_writer.hpp:7