Raylib C++  1.0.0
Encapsulates the raylib library
Static Public Member Functions | List of all members
raylib::helper::FileHelper Class Reference

Helper class for files. More...

#include <FileHelper.hpp>

Collaboration diagram for raylib::helper::FileHelper:
Collaboration graph

Static Public Member Functions

static std::vector< unsigned char > loadFileData (const std::string &fileName)
 Load file data as byte array (read) More...
 
static std::string loadFileText (const std::string &fileName)
 Load text data from file (read),. More...
 
static bool saveFileText (const std::string &fileName, const std::string &text)
 Save text data to file (write) More...
 
static bool fileExists (const std::string &fileName)
 Check if file exists. More...
 
static bool directoryExists (const std::string &dirPath)
 Check if directory exists. More...
 
static bool isFileExtension (const std::string &fileName, const std::string &ext)
 Check if file extension is valid. More...
 
static std::string getFileExtension (const std::string &fileName)
 Get file extension. More...
 
static std::string getFileName (const std::string &filePath)
 Get file name. More...
 
static std::string getFileNameWithoutExt (const std::string &filePath)
 Get file name without extension. More...
 
static std::string getDirectoryPath (const std::string &filePath)
 Get directory path. More...
 
static std::string getPrevDirectoryPath (const std::string &dirPath)
 Get previous directory path. More...
 
static std::string getWorkingDirectory ()
 Get working directory. More...
 
static std::vector< std::string > getDirectoryFiles (const std::string &dirPath, const bool &recursive=false)
 Get all files in directory. More...
 
static std::vector< std::string > getDirectoryFiles (const std::string &dirPath, const std::function< bool(const std::string &)> &filterFunction)
 Get all files in directory with a filter. More...
 
static std::vector< std::string > getDirectoryFiles (const std::string &dirPath, const bool &recursive, const std::function< bool(const std::string &fileName)> &filterFunction)
 Get all files in directory with a filter. More...
 
static void changeDirectory (const std::string &dir)
 Change working directory. More...
 
static bool isFileDropped ()
 Check if a file has been dropped on the window. More...
 
static std::vector< std::string > getDroppedFiles ()
 Get dropped files paths. More...
 
static long long getFileModTime (const std::string &fileName)
 Get file modification time (last write time) More...
 

Detailed Description

Helper class for files.

Member Function Documentation

◆ changeDirectory()

void raylib::helper::FileHelper::changeDirectory ( const std::string &  dir)
static

Change working directory.

Parameters
dirthe directory
Returns
true on success

◆ directoryExists()

bool raylib::helper::FileHelper::directoryExists ( const std::string &  dirPath)
static

Check if directory exists.

Parameters
dirPaththe directory path
Returns
true if directory exists
Here is the caller graph for this function:

◆ fileExists()

bool raylib::helper::FileHelper::fileExists ( const std::string &  fileName)
static

Check if file exists.

Parameters
fileNamethe file name
Returns
true if file exists

◆ getDirectoryFiles() [1/3]

static std::vector<std::string> raylib::helper::FileHelper::getDirectoryFiles ( const std::string &  dirPath,
const bool &  recursive,
const std::function< bool(const std::string &fileName)> &  filterFunction 
)
static

Get all files in directory with a filter.

Parameters
dirPaththe directory path
filterFunctionthe filter function to apply (true to keep file)
recursivetrue to get all files in subdirectories If null, all files are kept
Returns
the files

◆ getDirectoryFiles() [2/3]

std::vector< std::string > raylib::helper::FileHelper::getDirectoryFiles ( const std::string &  dirPath,
const bool &  recursive = false 
)
static

Get all files in directory.

Parameters
dirPaththe directory path
recursivetrue to get all files in subdirectories
Returns
the files
Here is the caller graph for this function:

◆ getDirectoryFiles() [3/3]

std::vector< std::string > raylib::helper::FileHelper::getDirectoryFiles ( const std::string &  dirPath,
const std::function< bool(const std::string &)> &  filterFunction 
)
static

Get all files in directory with a filter.

Parameters
dirPaththe directory path
filterFunctionthe filter function to apply (true to keep file) If null, all files are kept
Returns
the files

◆ getDirectoryPath()

std::string raylib::helper::FileHelper::getDirectoryPath ( const std::string &  filePath)
static

Get directory path.

Parameters
filePaththe file path
Returns
the directory path

◆ getDroppedFiles()

std::vector< std::string > raylib::helper::FileHelper::getDroppedFiles ( )
static

Get dropped files paths.

Returns
the dropped files paths

◆ getFileExtension()

std::string raylib::helper::FileHelper::getFileExtension ( const std::string &  fileName)
static

Get file extension.

Parameters
fileNamethe file name
Returns
the file extension

◆ getFileModTime()

long long raylib::helper::FileHelper::getFileModTime ( const std::string &  fileName)
static

Get file modification time (last write time)

Parameters
fileNamethe file name
Returns
the file modification time

◆ getFileName()

std::string raylib::helper::FileHelper::getFileName ( const std::string &  filePath)
static

Get file name.

Parameters
filePaththe file path
Returns
the file name

◆ getFileNameWithoutExt()

std::string raylib::helper::FileHelper::getFileNameWithoutExt ( const std::string &  filePath)
static

Get file name without extension.

Parameters
filePaththe file path
Returns
the file name without extension
Here is the caller graph for this function:

◆ getPrevDirectoryPath()

std::string raylib::helper::FileHelper::getPrevDirectoryPath ( const std::string &  dirPath)
static

Get previous directory path.

Parameters
dirPaththe directory path
Returns
the previous directory path

◆ getWorkingDirectory()

std::string raylib::helper::FileHelper::getWorkingDirectory ( )
static

Get working directory.

Returns
the working directory

◆ isFileDropped()

bool raylib::helper::FileHelper::isFileDropped ( )
static

Check if a file has been dropped on the window.

Returns
true if a file has been dropped on the window

◆ isFileExtension()

bool raylib::helper::FileHelper::isFileExtension ( const std::string &  fileName,
const std::string &  ext 
)
static

Check if file extension is valid.

Parameters
fileNamethe file name
extthe extension
Returns
true if file extension is valid
Here is the caller graph for this function:

◆ loadFileData()

std::vector< unsigned char > raylib::helper::FileHelper::loadFileData ( const std::string &  fileName)
static

Load file data as byte array (read)

Parameters
fileNamethe file name
Returns
the byte array

◆ loadFileText()

std::string raylib::helper::FileHelper::loadFileText ( const std::string &  fileName)
static

Load text data from file (read),.

Parameters
fileNamethe file name
Returns
the text data

◆ saveFileText()

bool raylib::helper::FileHelper::saveFileText ( const std::string &  fileName,
const std::string &  text 
)
static

Save text data to file (write)

Parameters
fileNamethe file name
textthe text data
Returns
true on success

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