Leosac  0.8.0
Open Source Access Control
Leosac::Tools::UnixFs Class Reference

#include <unixfs.hpp>

Public Types

using FileList = std::list< std::string >
 

Static Public Member Functions

static std::string getCWD ()
 get current working directory without trailing slash More...
 
static FileList listFiles (const std::string &folder, const std::string &extension=std::string())
 list all files with the extension ".extension" in folder More...
 
static std::string stripPath (const std::string &filename)
 remove the full path from a filename More...
 
static std::string readAll (const std::string &path)
 read all file contents and put it in a string More...
 
static bool fileExists (const std::string &path)
 
template<typename T >
static T readSysFsValue (const std::string &path)
 read value from a sysfs file More...
 
template<typename T >
static void writeSysFsValue (const std::string &path, const T &val)
 write value to a sysfs file More...
 

Private Member Functions

 UnixFs ()=delete
 

Detailed Description

Definition at line 39 of file unixfs.hpp.

Member Typedef Documentation

◆ FileList

Definition at line 44 of file unixfs.hpp.

Constructor & Destructor Documentation

◆ UnixFs()

Leosac::Tools::UnixFs::UnixFs ( )
privatedelete

Member Function Documentation

◆ fileExists()

bool UnixFs::fileExists ( const std::string &  path)
static
Parameters
pathPath of the file
Returns
true is file exists

Definition at line 109 of file unixfs.cpp.

◆ getCWD()

std::string UnixFs::getCWD ( )
static

get current working directory without trailing slash

Returns
path

Definition at line 40 of file unixfs.cpp.

◆ listFiles()

UnixFs::FileList UnixFs::listFiles ( const std::string &  folder,
const std::string &  extension = std::string() 
)
static

list all files with the extension ".extension" in folder

Parameters
folder
extensionname without the dot
Returns
file list

Definition at line 55 of file unixfs.cpp.

◆ readAll()

std::string UnixFs::readAll ( const std::string &  path)
static

read all file contents and put it in a string

Parameters
pathPath of the file
Returns
file contents

Definition at line 98 of file unixfs.cpp.

◆ readSysFsValue()

template<typename T >
static T Leosac::Tools::UnixFs::readSysFsValue ( const std::string &  path)
inlinestatic

read value from a sysfs file

Parameters
pathPath of the sysfs target
Returns
Value read

Definition at line 88 of file unixfs.hpp.

◆ stripPath()

std::string UnixFs::stripPath ( const std::string &  filename)
static

remove the full path from a filename

Parameters
filenameto strip
Returns
filename without path

Definition at line 88 of file unixfs.cpp.

◆ writeSysFsValue()

template<typename T >
static void Leosac::Tools::UnixFs::writeSysFsValue ( const std::string &  path,
const T &  val 
)
inlinestatic

write value to a sysfs file

Parameters
pathPath of the sysfs target
valValue to write

Definition at line 107 of file unixfs.hpp.


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