File: temp_file.hpp

package info (click to toggle)
videolink 1.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 368 kB
  • ctags: 502
  • sloc: cpp: 3,210; ansic: 880; makefile: 121
file content (38 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
// See the file "COPYING" for licence details.

#ifndef INC_TEMP_FILE_HPP
#define INC_TEMP_FILE_HPP

#include <string>

class temp_file
{
public:
    explicit temp_file(const std::string & base_name);
    ~temp_file();

    void close();

    int get_fd() const { return fd_; }
    const std::string & get_name() const { return name_; }

    static void keep_all(bool keep);

private:
    int fd_;
    std::string name_;
};

class temp_dir
{
public:
    explicit temp_dir(const std::string & base_name);
    ~temp_dir();
    const std::string & get_name() const { return name_; }

private:
    std::string name_;
};

#endif // !INC_TEMP_FILE_HPP