The destructor may throw exceptions and since it’s superfluous we can
just remove it.
{
}
-Writer::~Writer()
-{
- if (!m_finalized) {
- finalize();
- }
-}
-
void
Writer::write(FileType file_type, const std::string& file_path)
{
optional<std::string>
Writer::finalize()
{
- m_finalized = true;
try {
do_finalize();
return nullopt;
{
public:
Writer(Context& ctx, const std::string& result_path);
- ~Writer();
// Register a file to include in the result. Does not throw.
void write(FileType file_type, const std::string& file_path);
private:
Context& m_ctx;
const std::string m_result_path;
- bool m_finalized = false;
std::vector<std::pair<FileType, std::string>> m_entries_to_write;
void do_finalize();