ifw-core 7.0.0
 
Loading...
Searching...
No Matches
ifw::core::utils::file Namespace Reference

Classes

class  ParameterFile
 Class to handle a set of parameters. More...
 
class  Yaml
 Class implementing the handling of Yaml files in the ICS environment. More...
 

Functions

std::string CheckAddExtension (const std::string &filename, const std::string &extension)
 Check if filename has the specified extension (no initiating dot). If not, add it.
 
void RemoveFile (const std::string &filename)
 Remove the referenced file, if it exists.
 
std::string LoadFile (const std::string &filename, std::string *complete_filename=nullptr)
 Load a file and return the content.
 
void SaveFile (const std::string &filename, const std::string &buffer, const bool overwrite=true)
 Save the contents inthe buffer into the given filename.
 
void CheckCreatePath (const std::string &path)
 Check if the given path exists. If not, create it.
 

Detailed Description

Todo

: Add semaphore protection.

: Move to ifw::core::utils::base + implement ifw::core::utils::file::ParameterFile class.

Function Documentation

◆ CheckAddExtension()

std::string ifw::core::utils::file::CheckAddExtension ( const std::string & filename,
const std::string & extension )

Check if filename has the specified extension (no initiating dot). If not, add it.

◆ CheckCreatePath()

void ifw::core::utils::file::CheckCreatePath ( const std::string & path)

Check if the given path exists. If not, create it.

Parameters
pathPath to check for.

◆ LoadFile()

std::string ifw::core::utils::file::LoadFile ( const std::string & filename,
std::string * complete_filename = nullptr )

Load a file and return the content.

Parameters
filenameName of the file. The file may be searched for in the ICS file locations.
Returns
Content of file, if found.

◆ RemoveFile()

void ifw::core::utils::file::RemoveFile ( const std::string & filename)

Remove the referenced file, if it exists.

◆ SaveFile()

void ifw::core::utils::file::SaveFile ( const std::string & filename,
const std::string & buffer,
const bool overwrite = true )

Save the contents inthe buffer into the given filename.

Parameters
filenameName of file. Will be resolved, if necessary.
bufferBuffer to write into the file.
overwriteOverwrite (replace) file if already existing.