#include "CUtils.h"
Functions | |
string | GetFileName (const string filepath) |
Extract and return the file name from file path. | |
vector< string > | Glob (const char *pattern) |
c utility to extract a list of files. | |
bool | IsBinaryFile (const char *filename) |
Check if a file exists and is a binary file. | |
bool | IsDirectory (const char *dirname) |
Check if a directory exists. | |
bool | IsTextFile (const char *filename) |
Check if a file exists and is a txt file. | |
bool | ListDirectories (const string maindir, vector< string > &subdir) |
Returns list of subdirectories. | |
double | medianbiasfactor (const int nn) |
Returns the bias factor when computing a median with nn samples. | |
string | ReplaceAll (string str, const string &from, const string &to) |
Replace all occurences of a sub-string. | |
vector< string > | SplitString (const string stringtodivide, const char separator) |
Splits a string. | |
string | StringToUpper (string stringtoconvert) |
Convert a string to uppercase. |
string GetFileName | ( | const string | filepath | ) |
Extract and return the file name from file path.
filepath | file path |
vector<string> Glob | ( | const char * | pattern | ) |
c utility to extract a list of files.
Returns a list of files matching a pattern.
pattern | file pattern |
bool IsBinaryFile | ( | const char * | filename | ) |
Check if a file exists and is a binary file.
Returns true if 'filename' is an existing binary file.
filename | path to file to test |
bool IsDirectory | ( | const char * | dirname | ) |
Check if a directory exists.
Returns true if 'dirname' is an existing directory.
dirname | path to directory to test |
bool IsTextFile | ( | const char * | filename | ) |
Check if a file exists and is a txt file.
Returns true if 'filename' is an existing text file.
filename | path to file to test |
bool ListDirectories | ( | const string | maindir, | |
vector< string > & | subdir | |||
) |
Returns list of subdirectories.
The vector 'subdir' is filled with directories contained in 'maindir' Returns true if success
maindir | path to main directory |
double medianbiasfactor | ( | const int | nn | ) |
Returns the bias factor when computing a median with nn samples.
nn | number of samples |
string ReplaceAll | ( | string | str, | |
const string & | from, | |||
const string & | to | |||
) |
Replace all occurences of a sub-string.
All occurences of substring 'from' are replaced by 'to'. The modified string is returned.
str | string to modify | |
from | substring to replace from | |
from | substring to replace to |
vector<string> SplitString | ( | const string | stringtodivide, | |
const char | separator | |||
) |
Splits a string.
A string is divided into an array of words. The separator defines where to break the string. The separator should be a single character. A vector of string is returned.
stringtodivide | string to divide | |
separator | separator |
string StringToUpper | ( | string | stringtoconvert | ) |
Convert a string to uppercase.
stringtoconvert | string to convert |