linc 0.7
Linc is a general-purpose programming language inspired by C
Loading...
Searching...
No Matches
linc::Files Class Referencefinal

File management utility class. More...

#include <Files.hpp>

Static Public Member Functions

static std::string toAbsolute (const std::string &filepath_string)
 STD wrapper to convert a filepath to absolute format.
 
static std::fstream * load (const std::string &filepath_string, bool write)
 Add given file to the cache and open it.
 
static std::string read (const std::string &filepath_string)
 Load a file in memory, then read and return its contents.
 
static bool exists (const std::string &filepath_string)
 Check whether a given file exists, based on its filepath.
 
static void write (const std::string &filepath_string, const std::string &contents)
 Write contents to a specified file by its filepath.
 

Detailed Description

File management utility class.

Member Function Documentation

◆ exists()

bool linc::Files::exists ( const std::string & filepath_string)
static

Check whether a given file exists, based on its filepath.

Parameters
filepath_stringThe filepath to read in string format.
Returns
Boolean corresponding to the result of the test.

◆ load()

std::fstream * linc::Files::load ( const std::string & filepath_string,
bool write = false )
static

Add given file to the cache and open it.

Parameters
filepath_stringThe filepath to read in string format.
writeWhether to open the file with write permissions.
Returns
Pointer to the file's file-stream object.

◆ read()

std::string linc::Files::read ( const std::string & filepath_string)
static

Load a file in memory, then read and return its contents.

Parameters
filepath_stringThe filepath to read in string format.
Returns
The contents of the file.

◆ toAbsolute()

std::string linc::Files::toAbsolute ( const std::string & filepath_string)
static

STD wrapper to convert a filepath to absolute format.

Parameters
filepath_stringThe relative filepath.
Returns
The absolute equivalent of the given filepath.

◆ write()

void linc::Files::write ( const std::string & filepath_string,
const std::string & contents )
static

Write contents to a specified file by its filepath.

Parameters
filepath_stringThe filepath to write to in string format.
contentsThe new contents of the file.

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