C++ Essence Library 0.1.0
A Utility Library for Modern C++ Programming
Loading...
Searching...
No Matches
essence::io::abstract::virtual_fs_operator Class Reference

Provides an ability to operator files on a virtual file system defined by the user. More...

#include <virtual_fs_operator.hpp>

Public Member Functions

template<typename T >
requires (!std::same_as<std::decay_t<T>, virtual_fs_operator>)
 virtual_fs_operator (T &&value)
 
bool exists (std::string_view path) const
 Checks whether a file exists.
 
bool is_file (std::string_view path) const
 Checks whether a path names a regular file.
 
bool is_directory (std::string_view path) const
 Checks whether a path names a directory.
 
std::unique_ptr< std::iostream > open (std::string_view path, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out) const
 Opens a file in read-write mode.
 
std::unique_ptr< std::istream > open_read (std::string_view path, std::ios_base::openmode mode=std::ios_base::in) const
 Opens a file in read-only mode.
 
std::unique_ptr< std::ostream > open_write (std::string_view path, std::ios_base::openmode mode=std::ios_base::out) const
 Opens a file in write-only mode.
 

Detailed Description

Provides an ability to operator files on a virtual file system defined by the user.

Member Function Documentation

◆ exists()

bool essence::io::abstract::virtual_fs_operator::exists ( std::string_view path) const
inlinenodiscard

Checks whether a file exists.

Parameters
pathThe path of the file.
Returns
True if the file exists; otherwise false.

◆ is_directory()

bool essence::io::abstract::virtual_fs_operator::is_directory ( std::string_view path) const
inlinenodiscard

Checks whether a path names a directory.

Parameters
pathThe path.
Returns
True if the path names a directory; otherwise false.

◆ is_file()

bool essence::io::abstract::virtual_fs_operator::is_file ( std::string_view path) const
inlinenodiscard

Checks whether a path names a regular file.

Parameters
pathThe path.
Returns
True if the path names a regular file; otherwise false.

◆ open()

std::unique_ptr< std::iostream > essence::io::abstract::virtual_fs_operator::open ( std::string_view path,
std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out ) const
inlinenodiscard

Opens a file in read-write mode.

Parameters
pathThe path of the file.
modeThe open mode.
Returns
A std::iostream to read or write the file.

◆ open_read()

std::unique_ptr< std::istream > essence::io::abstract::virtual_fs_operator::open_read ( std::string_view path,
std::ios_base::openmode mode = std::ios_base::in ) const
inlinenodiscard

Opens a file in read-only mode.

Parameters
pathThe path of the file.
modeThe open mode.
Returns
A std::istream to read the file.

◆ open_write()

std::unique_ptr< std::ostream > essence::io::abstract::virtual_fs_operator::open_write ( std::string_view path,
std::ios_base::openmode mode = std::ios_base::out ) const
inlinenodiscard

Opens a file in write-only mode.

Parameters
pathThe path of the file.
modeThe open mode.
Returns
A std::istream to write the file.

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