Ocean
Ocean::IO::ScopedFile Class Referencefinal

This class implements a scoped file object which will delete the underlying file from the filesystem when the scope ends. More...

Inheritance diagram for Ocean::IO::ScopedFile:

Public Member Functions

 ScopedFile (ScopedFile &&scopedFile)
 Move constructor. More...
 
 ScopedFile (const File &file)
 Create a new scoped file. More...
 
 ScopedFile (const std::string &filename)
 Create a new scoped file. More...
 
 ~ScopedFile ()
 Destructs this object and deletes the actual file. More...
 
ScopedFileoperator= (ScopedFile &&scopedFile)
 Move operator. More...
 
- Public Member Functions inherited from Ocean::IO::File
 File ()
 Creates an empty file. More...
 
 File (const std::string &filename)
 Create a new file. More...
 
bool isValid () const override
 Returns whether the path is valid. More...
 
bool exists () const override
 Returns whether the file exists already. More...
 
bool remove () const
 Removes this file from the filesystem. More...
 
std::string base () const
 Returns the base of this file. More...
 
std::string extension () const
 Returns the extension of this file. More...
 
std::string name () const
 Returns the name of this file. More...
 
std::string baseName () const
 Returns the base name of this file. More...
 
- Public Member Functions inherited from Ocean::IO::Path
virtual ~Path ()=default
 Destructs a path. More...
 
Type type () const
 Returns the type of this path. More...
 
bool isAbsolute () const
 Returns whether this path is absolute. More...
 
bool isRelative () const
 Returns whether this path is relative. More...
 
bool isNull () const
 Returns whether this path holds no valid. More...
 
bool operator== (const Path &right) const
 Returns whether two paths are equal. More...
 
bool operator!= (const Path &path) const
 Returns whether two paths are not equal. More...
 
const std::string & operator() () const
 Returns the value of this path. More...
 
bool operator< (const Path &path) const
 Less operator comparing the actual strings of two paths. More...
 

Protected Member Functions

 ScopedFile (const ScopedFile &scopedFile)=delete
 Disabled copy constructor. More...
 
ScopedFileoperator= (const ScopedFile &scopedFile)=delete
 Disabled copy constructor. More...
 
- Protected Member Functions inherited from Ocean::IO::Path
 Path ()=default
 Creates a new undefined path. More...
 
 Path (const Path &path)=default
 Copy constructor. More...
 
 Path (const std::string &value)
 Creates a new path. More...
 
void checkPath (const Type expectType)
 Checks the type of this path and trims it. More...
 
void trim ()
 Trims this path. More...
 
Pathoperator= (const Path &path)=default
 Default assign operator. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::IO::Path
enum  Type {
  TYPE_INVALID = 0 , TYPE_FILE = 1 , TYPE_DIRECTORY = 2 , TYPE_ABSOLUTE = 4 ,
  TYPE_RELATIVE = 8 , TYPE_NETWORK = 16
}
 Definition of different path types. More...
 
enum  Separator { SEPARATOR_UNDEFINED = 0 , SEPARATOR_SLASH = '/' , SEPARATOR_BACKSLASH = '\\' }
 Definition of path separators. More...
 
- Static Public Member Functions inherited from Ocean::IO::File
static bool existsApple (const std::string &file)
 Returns whether a file exists (specialization for Apple platforms). More...
 
- Static Public Member Functions inherited from Ocean::IO::Path
static bool isSeparator (const char character)
 Returns whether a given character is a separator. More...
 
static char defaultSeparator ()
 Returns the default separator of a path. More...
 
- Protected Attributes inherited from Ocean::IO::Path
Type pathType_ = TYPE_INVALID
 Path type. More...
 
std::string pathValue_
 Path value. More...
 

Detailed Description

This class implements a scoped file object which will delete the underlying file from the filesystem when the scope ends.

See also
File

Constructor & Destructor Documentation

◆ ScopedFile() [1/4]

Ocean::IO::ScopedFile::ScopedFile ( ScopedFile &&  scopedFile)
inline

Move constructor.

Parameters
scopedFileThe scoped file to be moved

◆ ScopedFile() [2/4]

Ocean::IO::ScopedFile::ScopedFile ( const File file)
inlineexplicit

Create a new scoped file.

Parameters
fileThe file for which the new scoped object will be created

◆ ScopedFile() [3/4]

Ocean::IO::ScopedFile::ScopedFile ( const std::string &  filename)
inlineexplicit

Create a new scoped file.

Parameters
filenameThe name of the file for which a new scoped object will be created

◆ ~ScopedFile()

Ocean::IO::ScopedFile::~ScopedFile ( )

Destructs this object and deletes the actual file.

◆ ScopedFile() [4/4]

Ocean::IO::ScopedFile::ScopedFile ( const ScopedFile scopedFile)
protecteddelete

Disabled copy constructor.

Parameters
scopedFileFile which would be copied

Member Function Documentation

◆ operator=() [1/2]

ScopedFile& Ocean::IO::ScopedFile::operator= ( const ScopedFile scopedFile)
protecteddelete

Disabled copy constructor.

Parameters
scopedFileFile which would be copied
Returns
Reference to this object

◆ operator=() [2/2]

ScopedFile& Ocean::IO::ScopedFile::operator= ( ScopedFile &&  scopedFile)

Move operator.

Parameters
scopedFileThe scoped file to be moved
Returns
Reference to this object

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