pstore2
Public Types | Public Member Functions | Protected Member Functions | List of all members
pstore::file::deleter_base Class Reference

A class which, on destruction, will delete a file whose name is passed to the constructor. More...

#include <file.hpp>

Inheritance diagram for pstore::file::deleter_base:
Inheritance graph
[legend]

Public Types

using unlink_proc = std::function< void(std::string const &)>
 

Public Member Functions

 deleter_base (deleter_base const &)=delete
 
 deleter_base (deleter_base &&) noexcept=delete
 
deleter_baseoperator= (deleter_base const &)=delete
 
deleter_baseoperator= (deleter_base &&) noexcept=delete
 
void unlink ()
 Explicitly deletes the file at the path given to the constructor. More...
 
void release () noexcept
 Releases the file path given to the constructor so that it will not be deleted when the instance is destroyed. More...
 

Protected Member Functions

 deleter_base (std::string path, unlink_proc unlinker)
 

Detailed Description

A class which, on destruction, will delete a file whose name is passed to the constructor.

The path can be "released" (so that it won't be deleted) by calling the release() method.

Member Function Documentation

◆ release()

void pstore::file::deleter_base::release ( )
inlinenoexcept

Releases the file path given to the constructor so that it will not be deleted when the instance is destroyed.

◆ unlink()

void pstore::file::deleter_base::unlink ( )

Explicitly deletes the file at the path given to the constructor.

Calling this function will immediately delete the file at the path passed to the constructor unless the release() method has been called. If this function is called, the destructor will not attempt to delete the file a second time.


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