Helios++
Helios software for LiDAR simulations
FileUtils Class Reference

Class with util functions to work with files. More...

#include <FileUtils.h>

Static Public Member Functions

static std::vector< std::string > handleFilePath (std::map< std::string, ObjectT > &params)
 Handle the filepath or efilepath argument from a map of parameters in the context of geometry loading. More...
 
static std::vector< std::string > getFilesByExpression (std::string const pathExpression)
 Obtain the files which are referenced by the path expression. More...
 
static void unzipFile (std::string const inputPath, std::string const outputPath)
 Decompress a file generated through ZipSyncFileWriter. More...
 
static void extractExtensionAndPathWithoutExtension (std::string const &path, std::string &ext, std::string &pathNonExt)
 Extract the extension and the path without extension from given path with extension. More...
 
static std::string craftPathWithSuffix (std::string const &pathNonExt, std::string const &suffix, std::string const &ext)
 Build a string such that: builtString = pathNonExt + suffix + ext. More...
 

Static Public Attributes

static char const pathSeparator
 Path separator constant. More...
 

Detailed Description

Class with util functions to work with files.

Author
Alberto M. Esmoris Pena
Version
1.0

Member Function Documentation

◆ craftPathWithSuffix()

std::string FileUtils::craftPathWithSuffix ( std::string const &  pathNonExt,
std::string const &  suffix,
std::string const &  ext 
)
static

Build a string such that: builtString = pathNonExt + suffix + ext.

Parameters
pathNonExtThe path without extension
suffixThe suffix to be appended to the path without extension
extThe extension to be appended after the suffix
Returns
Built string : pathNonExt + suffix + ext

◆ extractExtensionAndPathWithoutExtension()

void FileUtils::extractExtensionAndPathWithoutExtension ( std::string const &  path,
std::string &  ext,
std::string &  pathNonExt 
)
static

Extract the extension and the path without extension from given path with extension.

Parameters
[in]pathThe patch which extension must be extracted
[out]extWhere the extracted extension will be stored
[out]pathNonExtWhere the path without extension will be stored

◆ getFilesByExpression()

std::vector< std::string > FileUtils::getFilesByExpression ( std::string const  pathExpression)
static

Obtain the files which are referenced by the path expression.

For instance, the expression "/tmp/heat.*data.csv" would obtain all files in /tmp/ directory which start by "heat" and end by "data.csv"

Another example, using expression "/home/helios/sceneparts/.*\.obj" would obtain all files in "/home/helios/sceneparts/" which end by ".obj"

Parameters
pathExpressionThe path expression itself. For instance "/tmp/.*\.csv"

◆ handleFilePath()

std::vector< std::string > FileUtils::handleFilePath ( std::map< std::string, ObjectT > &  params)
static

Handle the filepath or efilepath argument from a map of parameters in the context of geometry loading.

Parameters
paramsMap of parameters defining the geometry loading process
Returns
Vector of parsed file paths (1 for filepath, n for efilepath)

◆ unzipFile()

void FileUtils::unzipFile ( std::string const  inputPath,
std::string const  outputPath 
)
static

Decompress a file generated through ZipSyncFileWriter.

Parameters
inputPathPath to the compressed file to be decompressed
outputPathPath where the decompressed file will be written
See also
ZipSyncFileWriter

Member Data Documentation

◆ pathSeparator

char const FileUtils::pathSeparator
static
Initial value:
=
'/'

Path separator constant.


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