RADLib
RADical C++ application framework
RADCore::RADTemporaryDirectory Class Reference

RAII temporary directory with optional auto-remove. More...

#include <RADCore.h>

Public Member Functions

 RADTemporaryDirectory (std::string prefix="radlib")
 Creates a temporary directory with prefix. More...
 
 ~RADTemporaryDirectory ()
 Removes the directory when autoRemove is enabled. More...
 
 RADTemporaryDirectory (const RADTemporaryDirectory &)=delete
 Temporary directories own a filesystem path and cannot be copied. More...
 
RADTemporaryDirectoryoperator= (const RADTemporaryDirectory &)=delete
 Temporary directories own a filesystem path and cannot be copied. More...
 
 RADTemporaryDirectory (RADTemporaryDirectory &&other) noexcept
 Moves ownership from other. More...
 
RADTemporaryDirectoryoperator= (RADTemporaryDirectory &&other) noexcept
 Moves ownership from other. More...
 
bool isValid () const
 Returns true when directory creation succeeded. More...
 
const std::string & path () const
 Returns the temporary directory path. More...
 
void setAutoRemove (bool enabled)
 Enables or disables removal on destruction. More...
 
bool autoRemove () const
 Returns true when destruction removes the directory. More...
 
bool remove ()
 Removes the directory immediately. More...
 

Detailed Description

RAII temporary directory with optional auto-remove.

Constructor & Destructor Documentation

◆ RADTemporaryDirectory() [1/3]

RADCore::RADTemporaryDirectory::RADTemporaryDirectory ( std::string  prefix = "radlib")
explicit

Creates a temporary directory with prefix.

◆ ~RADTemporaryDirectory()

RADCore::RADTemporaryDirectory::~RADTemporaryDirectory ( )

Removes the directory when autoRemove is enabled.

◆ RADTemporaryDirectory() [2/3]

RADCore::RADTemporaryDirectory::RADTemporaryDirectory ( const RADTemporaryDirectory )
delete

Temporary directories own a filesystem path and cannot be copied.

◆ RADTemporaryDirectory() [3/3]

RADCore::RADTemporaryDirectory::RADTemporaryDirectory ( RADTemporaryDirectory &&  other)
noexcept

Moves ownership from other.

Member Function Documentation

◆ autoRemove()

bool RADCore::RADTemporaryDirectory::autoRemove ( ) const

Returns true when destruction removes the directory.

◆ isValid()

bool RADCore::RADTemporaryDirectory::isValid ( ) const

Returns true when directory creation succeeded.

◆ operator=() [1/2]

RADTemporaryDirectory& RADCore::RADTemporaryDirectory::operator= ( const RADTemporaryDirectory )
delete

Temporary directories own a filesystem path and cannot be copied.

◆ operator=() [2/2]

RADTemporaryDirectory& RADCore::RADTemporaryDirectory::operator= ( RADTemporaryDirectory &&  other)
noexcept

Moves ownership from other.

◆ path()

const std::string& RADCore::RADTemporaryDirectory::path ( ) const

Returns the temporary directory path.

◆ remove()

bool RADCore::RADTemporaryDirectory::remove ( )

Removes the directory immediately.

◆ setAutoRemove()

void RADCore::RADTemporaryDirectory::setAutoRemove ( bool  enabled)

Enables or disables removal on destruction.


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