Public Member Functions | Static Public Member Functions | Private Attributes
utilmm::tempfile Class Reference

#include <system.hh>

List of all members.

Public Member Functions

FILE * detach ()
FILE * handle () const
boost::filesystem::path path () const
 tempfile ()
 tempfile (std::string const &basename)
 ~tempfile ()

Static Public Member Functions

static FILE * create ()
static FILE * mkstemp (std::string const &base, boost::filesystem::path &path)

Private Attributes

auto_close m_guard
boost::filesystem::path m_path

Detailed Description

A temporary file. It is created on construction and removed on destruction

Definition at line 89 of file system.hh.


Constructor & Destructor Documentation

Create a temporary file. If you use this constructor, you cannot have the file name. You'll have to use only the file handle.

Exceptions:
unix_error

Definition at line 127 of file system.cc.

Close and destroy the file

Definition at line 130 of file system.cc.

tempfile::tempfile ( std::string const &  basename)

Create a temporary file using a base name The file name is available using path()

The tempfile() version is more secure. Use only this constructor if you need the file path

Definition at line 120 of file system.cc.


Member Function Documentation

FILE * tempfile::create ( ) [static]

Creates a temporary file

Returns:
the file descriptor to the open file
Exceptions:
unix_erroran error occured

Definition at line 94 of file system.cc.

FILE * tempfile::detach ( )

Disassociates this object from the temporary file After a call to disassociate(), path() and fd() are no longer available

Returns:
the file path

Definition at line 147 of file system.cc.

FILE * tempfile::handle ( void  ) const

Get the underlying file handle

Definition at line 141 of file system.cc.

FILE * tempfile::mkstemp ( std::string const &  base,
boost::filesystem::path &  path 
) [static]

Wrapper around mkstemp Do not use this function to create a temporary file Use a tempfile object instead

Definition at line 102 of file system.cc.

boost::filesystem::path tempfile::path ( ) const

Get the file path The file path is only available if the tempfile(std::string) constructor has been used.

Returns:
the file path or an empty path if it is not available

Definition at line 155 of file system.cc.


Member Data Documentation

Definition at line 92 of file system.hh.

boost::filesystem::path utilmm::tempfile::m_path [private]

Definition at line 91 of file system.hh.


The documentation for this class was generated from the following files:


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:31