Tkrzw
Public Member Functions | List of all members
tkrzw::TemporaryDirectory Class Reference

Temporary directory whose life duration is bound with the object. More...

#include <tkrzw_file_util.h>

Public Member Functions

 TemporaryDirectory (bool cleanup=true, const std::string &prefix="", const std::string &base_dir="")
 Constructor. More...
 
 ~TemporaryDirectory ()
 Destructor. More...
 
Status CreationStatus () const
 Checks whether the creation of the directory is successful. More...
 
std::string Path () const
 Gets the path of the directory. More...
 
std::string MakeUniquePath (const std::string &prefix="", const std::string &suffix="") const
 Makes a unique path in the temporary directory. More...
 
Status CleanUp () const
 Removes all contents of the temporary directory. More...
 

Detailed Description

Temporary directory whose life duration is bound with the object.

Constructor & Destructor Documentation

◆ TemporaryDirectory()

tkrzw::TemporaryDirectory::TemporaryDirectory ( bool  cleanup = true,
const std::string &  prefix = "",
const std::string &  base_dir = "" 
)

Constructor.

Parameters
cleanupIf true, the temporary directory is removed when the object dies.
prefixA prefix given to the directory. If empty, it is not used.
base_dirA base directory to contain the directory. If empty, the standard temporary directory of the sytem is used.

◆ ~TemporaryDirectory()

tkrzw::TemporaryDirectory::~TemporaryDirectory ( )

Destructor.

Member Function Documentation

◆ CreationStatus()

Status tkrzw::TemporaryDirectory::CreationStatus ( ) const

Checks whether the creation of the directory is successful.

Returns
The result status.

◆ Path()

std::string tkrzw::TemporaryDirectory::Path ( ) const

Gets the path of the directory.

Returns
The path of the directory.

◆ MakeUniquePath()

std::string tkrzw::TemporaryDirectory::MakeUniquePath ( const std::string &  prefix = "",
const std::string &  suffix = "" 
) const

Makes a unique path in the temporary directory.

◆ CleanUp()

Status tkrzw::TemporaryDirectory::CleanUp ( ) const

Removes all contents of the temporary directory.

Returns
The result status.