spot 2.16
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
spot::temporary_file Class Reference

Temporary file name. More...

#include <spot/misc/tmpfile.hh>

Inheritance diagram for spot::temporary_file:
Collaboration diagram for spot::temporary_file:

Public Types

typedef std::list< temporary_file * >::iterator cleanpos_t
 Iterator position in the cleanup list.
 

Public Member Functions

SPOT_LOCAL temporary_file (char *name, cleanpos_t cp)
 Build a temporary file wrapper.
 
 temporary_file (const temporary_file &other)=delete
 
virtual ~temporary_file () override
 Destroy the temporary file.
 
const char * name () const
 Return the file name.
 
virtual void print (std::ostream &os, const char *) const final override
 Print the file name.
 

Protected Attributes

char * name_
 File name.
 
cleanpos_t cleanpos_
 Cleanup-list position.
 

Friends

std::ostream & operator<< (std::ostream &os, const temporary_file *f)
 Stream the file name.
 

Detailed Description

Temporary file name.

This class serves a dual purpose.

  1. It carries the name of a temporary file, created with create_tmpfile().
  2. It represents the life of the associated file. The file is erased as soon as the temporary_file instance is destroyed.

Note that there are two ways to destroy temporary_file instances. Either directly with delete, or indirectly by calling cleanup_tmpfiles(). You should never delete an instance that has been created before the last call to cleanup_tmpfiles(), because that instance has already been deleted.

Member Typedef Documentation

◆ cleanpos_t

typedef std::list<temporary_file*>::iterator spot::temporary_file::cleanpos_t

Iterator position in the cleanup list.

Constructor & Destructor Documentation

◆ temporary_file()

SPOT_LOCAL spot::temporary_file::temporary_file ( char *  name,
cleanpos_t  cp 
)

Build a temporary file wrapper.

◆ ~temporary_file()

virtual spot::temporary_file::~temporary_file ( )
overridevirtual

Destroy the temporary file.

Member Function Documentation

◆ name()

const char * spot::temporary_file::name ( ) const
inline

Return the file name.

◆ print()

virtual void spot::temporary_file::print ( std::ostream &  os,
const char *   
) const
inlinefinaloverridevirtual

Print the file name.

Implements spot::printable.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const temporary_file f 
)
friend

Stream the file name.

Member Data Documentation

◆ cleanpos_

cleanpos_t spot::temporary_file::cleanpos_
protected

Cleanup-list position.

◆ name_

char* spot::temporary_file::name_
protected

File name.


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

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8