summaryrefslogtreecommitdiff
path: root/AK/TemporaryFile.h
blob: 624eeb4c9b22b464e6847567c11d2959afc02716 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include "AKString.h"
#include <stdio.h>

namespace AK {

class TemporaryFile {
public:
    TemporaryFile();
    ~TemporaryFile();

    bool is_valid() const { return m_stream; }
    FILE* stream() { return m_stream; }
    String file_name() const { return m_file_name; }
    void sync();

private:
    FILE* m_stream { nullptr };
    String m_file_name;
};

}

using AK::TemporaryFile;