libabigail
Public Member Functions | Static Public Member Functions | List of all members
temp_file Class Reference

A temporary file. More...

#include <abg-tools-utils.h>

Public Member Functions

const char * get_path () const
 Return the path to the temporary file. More...
 
std::fstream & get_stream ()
 Get the fstream to the temporary file. More...
 
bool is_good () const
 Test if the temporary file has been created and is usable. More...
 

Static Public Member Functions

static temp_file_sptr create ()
 Create the temporary file and return it if it's usable. More...
 

Detailed Description

A temporary file.

This is a helper file around the mkstemp API.

Once the temporary file is created, users can interact with it using an fstream. They can also get the path to the newly created temporary file.

When the instance of temp_file is destroyed, the underlying resources are de-allocated, the underlying temporary file is closed and removed.

Definition at line 180 of file abg-tools-utils.h.

Member Function Documentation

◆ create()

temp_file_sptr create ( )
static

Create the temporary file and return it if it's usable.

Returns
the newly created temporary file if it's usable, nil otherwise.

Definition at line 1476 of file abg-tools-utils.cc.

◆ get_path()

const char * get_path ( ) const

Return the path to the temporary file.

Returns
the path to the temporary file if it's usable, otherwise return nil.

Definition at line 1448 of file abg-tools-utils.cc.

◆ get_stream()

std::fstream & get_stream ( )

Get the fstream to the temporary file.

Note that the current process is aborted if this member function is invoked on an instance of temp_file that is not usable. So please test that the instance is usable by invoking the temp_file::is_good() member function on it first.

Returns
the fstream to the temporary file.

Definition at line 1465 of file abg-tools-utils.cc.

◆ is_good()

bool is_good ( ) const

Test if the temporary file has been created and is usable.

Returns
true iff the temporary file has been created and is useable.

Definition at line 1440 of file abg-tools-utils.cc.


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