BoosterSeat  0.1
A C++ library that includes common utilities that are used in other projects.
bst::fs_int Namespace Reference

Internal inline functions used only in this file. More...

Functions

void assertDoesNotExist (const Path &path)
 Checks if a path exists, otherwise it will throw an exception. More...
 
void assertExists (const Path &path)
 Checks if a path exists, otherwise it will throw an exception. More...
 
template<typename T >
void assertFileValid (const Path &path, T &file)
 Checks if the file is open and valid, otherwise it will throw an exception with the error code. This function is only for ifstream and ofstream. Used after opening a file. More...
 
void assertIsDirectory (const Path &path)
 Checks if the path exists and is a directory, otherwise it will throw an exception. More...
 
void assertIsRegularFile (const Path &path)
 Checks if the path exists and is a regular file, otherwise it will throw an exception. More...
 
void assertReadPermissions (const Path &path)
 Only works on Linux at the moment, requires the <unistd.h> header. More...
 
void assertWritePermissions (const Path &path)
 Checks a program has write permissions to the file or directory at the path, if not, throws an exception. Only works on Linux at the moment, requires the <unistd.h> header. More...
 
double convertMbToUnit (const double size_mb, const fs::units::Size unit)
 
bool exists (const Path &path)
 
std::uintmax_t get_file_size_bytes (const Path &path)
 
bool has_read_permissions (const Path &path)
 Returns true if the program has read permissions. More...
 
bool has_write_permission (const Path &path)
 Returns true if the path if the program has write permissions. More...
 
bool is_directory (const Path &path)
 Returns true if the path is a directory. More...
 
bool is_file (const Path &path)
 Checks if a path is a regular file. More...
 

Detailed Description

Internal inline functions used only in this file.

Function Documentation

◆ exists()

bool bst::fs_int::exists ( const Path path)
inline

Referenced by assertDoesNotExist(), assertExists(), and TEST().

Here is the caller graph for this function:

◆ is_file()

bool bst::fs_int::is_file ( const Path path)
inline

Checks if a path is a regular file.

Parameters
path- The path to check.
Returns
true - The path is a regular file.
false - The path is not a regular file.

◆ is_directory()

bool bst::fs_int::is_directory ( const Path path)
inline

Returns true if the path is a directory.

Parameters
path- The path to check.
Returns
true - The path is a directory.
false - The path is not a directory.

Referenced by assertIsDirectory().

Here is the caller graph for this function:

◆ has_write_permission()

bool bst::fs_int::has_write_permission ( const Path path)
inline

Returns true if the path if the program has write permissions.

Parameters
path- The path to check.
Returns
true - The program has write permissions.
false - The program does not have write permissions.

Referenced by assertWritePermissions().

Here is the caller graph for this function:

◆ has_read_permissions()

bool bst::fs_int::has_read_permissions ( const Path path)
inline

Returns true if the program has read permissions.

Parameters
path- The path to check.
Returns
true - The program has read permissions.
false - The program does not have read permissions.

Referenced by assertReadPermissions().

Here is the caller graph for this function:

◆ get_file_size_bytes()

std::uintmax_t bst::fs_int::get_file_size_bytes ( const Path path)
inline

◆ convertMbToUnit()

double bst::fs_int::convertMbToUnit ( const double  size_mb,
const fs::units::Size  unit 
)
inline

◆ assertExists()

void bst::fs_int::assertExists ( const Path path)
inline

Checks if a path exists, otherwise it will throw an exception.

Parameters
path- The path to check.
Exceptions
BoosterSeatException- If the path does not exist.

References exists().

Referenced by assertIsDirectory(), and assertIsRegularFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assertDoesNotExist()

void bst::fs_int::assertDoesNotExist ( const Path path)
inline

Checks if a path exists, otherwise it will throw an exception.

Parameters
path- The path to check.
Exceptions
BoosterSeatException- If the path does exist.

References exists().

Here is the call graph for this function:

◆ assertIsRegularFile()

void bst::fs_int::assertIsRegularFile ( const Path path)
inline

Checks if the path exists and is a regular file, otherwise it will throw an exception.

Parameters
path- The path to check.
Exceptions
BoosterSeatException- If the path does not exist or is not a

References assertExists().

Here is the call graph for this function:

◆ assertIsDirectory()

void bst::fs_int::assertIsDirectory ( const Path path)
inline

Checks if the path exists and is a directory, otherwise it will throw an exception.

Parameters
path- The path to check.
Exceptions
BoosterSeatException- If the path does not exist or is not a

References assertExists(), and is_directory().

Here is the call graph for this function:

◆ assertFileValid()

template<typename T >
void bst::fs_int::assertFileValid ( const Path path,
T &  file 
)
inline

Checks if the file is open and valid, otherwise it will throw an exception with the error code. This function is only for ifstream and ofstream. Used after opening a file.

Parameters
path- The path to the file.
file- The fstream object to check.

◆ assertWritePermissions()

void bst::fs_int::assertWritePermissions ( const Path path)
inline

Checks a program has write permissions to the file or directory at the path, if not, throws an exception. Only works on Linux at the moment, requires the <unistd.h> header.

Parameters
path- The path to the file.
Exceptions
BoosterSeatException- If the file does not have write permissions.

References has_write_permission().

Here is the call graph for this function:

◆ assertReadPermissions()

void bst::fs_int::assertReadPermissions ( const Path path)
inline

Only works on Linux at the moment, requires the <unistd.h> header.

Parameters
path
Exceptions
BoosterSeatException- If the file does not have read permissions.

References has_read_permissions().

Here is the call graph for this function: