![]() |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
Go to the source code of this file.
Functions | |
bool | createDirIfNotExist (const std::string &directoryName) |
Creates a directory if it does not exist. More... | |
std::string | getCurrentNodeName () |
Get the name of the current node on which the program is running. More... | |
time_t | getFileInDirPerTime (std::vector< std::string > &vecFile, const std::string &dirName, time_t mostRecentTime=0lu) |
Get the list of most recent files in a directory. More... | |
time_t | getFileModificationTime (const std::string &fileName) |
Get the last modification time of the given file. More... | |
std::string | getHomeDir () |
Gets the $HOME directory. More... | |
bool | getListAllFileInDir (std::list< std::string > &listFile, const std::string &dirName) |
Get the list of files in a directory. More... | |
void | getListFileInCurrentDir (std::list< std::string > &listFile, const std::string &expr) |
Function like a ls in shell. More... | |
bool | getListFileInDir (std::list< std::string > &listFile, const std::string &dirName, const std::string &expr) |
Get the list of files in a directory. More... | |
std::string | getProgramDirectory () |
Get the program directory. More... | |
std::string | getProgramLocation () |
Get the program location. More... | |
std::string | getProgramPrefix () |
Get the program prefix (installation directory without /bin) More... | |
bool | isStringMatchRegex (const std::string &str, const std::string &expression) |
Fonction qui dit si une chaine de caractère correspond à une expression régulière de regex. More... | |
void | makeListArgument (std::list< std::string > &listArgument, int argc, char **argv) |
Makes the argument list of a program. More... | |
bool | phoenix_chmod (const std::string &fileName, mode_t __mode=S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) |
Change the mode of a file or directory. More... | |
std::vector< std::string > | phoenix_find (const std::string &path) |
Find all files which matches the path expression (example : /path/*.cpp) More... | |
void | phoenix_find (std::vector< std::string > &vecFile, const std::string &path) |
Find all files which matches the path expression (example : /path/*.cpp) More... | |
time_t | phoenix_getClock () |
Get current time. More... | |
double | phoenix_getClockSec () |
Get current time. More... | |
std::string | phoenix_getDate () |
Get the current date. More... | |
std::string | phoenix_getDateCompact () |
Get the current date. More... | |
std::string | phoenix_getenv (const std::string &varName) |
Get the value of the given environment variable. More... | |
time_t | phoenix_getTime () |
Get the current time of the program. More... | |
std::string | phoenix_popen (const std::string &command) |
Execute the given command and returns the output of this command. More... | |
bool | phoenix_popen (const std::string &executionLogFile, const std::string &command, bool onlyLogOnFail) |
Execute the given command and returns the output of this command. More... | |
int | phoenix_popen (std::string &executionLog, const std::string &command) |
Execute the given command and returns the output of this command. More... | |
bool | phoenix_setenv (const std::string &name, const std::string &value, int overwrite=1) |
Set a environment variable. More... | |
bool | phoenix_unsetenv (const std::string &name) |
Unset a environment variable. More... | |
bool createDirIfNotExist | ( | const std::string & | directoryName | ) |
Creates a directory if it does not exist.
directoryName | : name of the directory we want to create |
Definition at line 242 of file string_system.cpp.
References isDirectoryExist().
Referenced by testStringSystem().
std::string getCurrentNodeName | ( | ) |
Get the name of the current node on which the program is running.
Definition at line 406 of file string_system.cpp.
References eraseCharsInStr(), and phoenix_popen().
Referenced by testStringSystem().
time_t getFileInDirPerTime | ( | std::vector< std::string > & | vecFile, |
const std::string & | dirName, | ||
time_t | mostRecentTime | ||
) |
Get the list of most recent files in a directory.
[out] | vecFile | : vector of found files (without directory name) |
dirName | : name of the directory to be scanned | |
mostRecentTime | : threshold time to select only most recent files |
Definition at line 274 of file string_system.cpp.
References getFileModificationTime().
Referenced by testStringSystem().
time_t getFileModificationTime | ( | const std::string & | fileName | ) |
Get the last modification time of the given file.
fileName | : name of the file we want the last modification time |
Definition at line 255 of file string_system.cpp.
Referenced by getFileInDirPerTime(), and testStringSystem().
std::string getHomeDir | ( | ) |
Gets the $HOME directory.
Definition at line 234 of file string_system.cpp.
References phoenix_getenv().
Referenced by testStringSystem().
bool getListAllFileInDir | ( | std::list< std::string > & | listFile, |
const std::string & | dirName | ||
) |
Get the list of files in a directory.
[out] | listFile | : list of files in the current directory |
dirName | : name of the directory to look in |
Definition at line 171 of file string_system.cpp.
Referenced by testStringSystem().
void getListFileInCurrentDir | ( | std::list< std::string > & | listFile, |
const std::string & | expr | ||
) |
Function like a ls in shell.
listFile | : list of the files witch match with expr |
expr | : expression like "name*.txt" or "*.dat" or "name_*_something_*.ext" |
Definition at line 126 of file string_system.cpp.
References isStringMatchRegex().
Referenced by testStringSystem().
bool getListFileInDir | ( | std::list< std::string > & | listFile, |
const std::string & | dirName, | ||
const std::string & | expr | ||
) |
Get the list of files in a directory.
[out] | listFile | : list of files in the current directory |
dirName | : name of the directory to look in | |
expr | : regular expression like *.txt or * |
Definition at line 150 of file string_system.cpp.
References isStringMatchRegex().
Referenced by testStringSystem().
std::string getProgramDirectory | ( | ) |
Get the program directory.
Definition at line 317 of file string_system.cpp.
References getDirectory(), and getProgramLocation().
Referenced by getProgramPrefix(), and testStringSystem().
std::string getProgramLocation | ( | ) |
Get the program location.
Definition at line 296 of file string_system.cpp.
Referenced by getProgramDirectory(), and testStringSystem().
std::string getProgramPrefix | ( | ) |
Get the program prefix (installation directory without /bin)
Definition at line 333 of file string_system.cpp.
References getDirectory(), and getProgramDirectory().
Referenced by testStringSystem().
bool isStringMatchRegex | ( | const std::string & | str, |
const std::string & | expression | ||
) |
Fonction qui dit si une chaine de caractère correspond à une expression régulière de regex.
str | : string dont on veut savoir si elle correspond à une expression régulière |
expression | : expression régulière regex |
Definition at line 94 of file string_system.cpp.
References createReleaseCurl::str.
Referenced by getListFileInCurrentDir(), getListFileInDir(), testRegExpr(), and testStringSystem().
void makeListArgument | ( | std::list< std::string > & | listArgument, |
int | argc, | ||
char ** | argv | ||
) |
Makes the argument list of a program.
[out] | listArgument | : list of the program arguments |
argc | : number of arguments passed to the program | |
argv | : array of the passed arguments to the program |
Definition at line 193 of file string_system.cpp.
Referenced by main().
bool phoenix_chmod | ( | const std::string & | fileName, |
mode_t | __mode | ||
) |
Change the mode of a file or directory.
fileName | : name of the file to be changed |
__mode | : mode to be applied to the given file (Default value makes files executable S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) |
Definition at line 395 of file string_system.cpp.
Referenced by testStringSystem().
std::vector<std::string> phoenix_find | ( | const std::string & | path | ) |
Find all files which matches the path expression (example : /path/*.cpp)
path | : path which can matches several files |
Definition at line 422 of file string_system.cpp.
References phoenix_find().
void phoenix_find | ( | std::vector< std::string > & | vecFile, |
const std::string & | path | ||
) |
Find all files which matches the path expression (example : /path/*.cpp)
[out] | vecFile | : vector of found files |
path | : path which can matches several files |
Definition at line 414 of file string_system.cpp.
References cutStringVector(), and phoenix_popen().
Referenced by phoenix_find(), and testStringSystem().
time_t phoenix_getClock | ( | ) |
Get current time.
Definition at line 431 of file string_system.cpp.
Referenced by phoenix_getClockSec().
double phoenix_getClockSec | ( | ) |
Get current time.
Definition at line 438 of file string_system.cpp.
References phoenix_getClock().
std::string phoenix_getDate | ( | ) |
Get the current date.
Definition at line 452 of file string_system.cpp.
References phoenix_getTime().
Referenced by PLog::close(), and PLog::open().
std::string phoenix_getDateCompact | ( | ) |
Get the current date.
Definition at line 463 of file string_system.cpp.
References phoenix_getTime().
Referenced by PLog::getLog().
std::string phoenix_getenv | ( | const std::string & | varName | ) |
Get the value of the given environment variable.
varName | : name of the environment variable to be used |
Definition at line 204 of file string_system.cpp.
Referenced by getCurrentDirectory(), getHomeDir(), and testStringSystem().
time_t phoenix_getTime | ( | ) |
Get the current time of the program.
Definition at line 445 of file string_system.cpp.
Referenced by PLog::getLog(), phoenix_getDate(), and phoenix_getDateCompact().
std::string phoenix_popen | ( | const std::string & | command | ) |
Execute the given command and returns the output of this command.
command | : command to be executed |
Definition at line 341 of file string_system.cpp.
References getFileContent().
Referenced by checkOptionCompletion(), getCurrentNodeName(), phoenix_find(), phoenix_popen(), and testPoenixPOpen().
bool phoenix_popen | ( | const std::string & | executionLogFile, |
const std::string & | command, | ||
bool | onlyLogOnFail | ||
) |
Execute the given command and returns the output of this command.
[out] | executionLogFile | : file which will get output of the given command, empty string if the command is empty or full log on fail |
command | : command to be executed | |
onlyLogOnFail | : true to log only if the command fails |
Definition at line 376 of file string_system.cpp.
References phoenix_popen(), and saveFileContent().
int phoenix_popen | ( | std::string & | executionLog, |
const std::string & | command | ||
) |
Execute the given command and returns the output of this command.
[out] | executionLog | : output of the given command, empty string if the command is empty or null character on fail |
command | : command to be executed |
Definition at line 358 of file string_system.cpp.
References getFileContent().
bool phoenix_setenv | ( | const std::string & | name, |
const std::string & | value, | ||
int | overwrite | ||
) |
Set a environment variable.
name | : name of the variable to be created |
value | : value of the variable to be created |
overwrite | : 1 to overwrite an existing variable, 0 to not to |
Definition at line 219 of file string_system.cpp.
Referenced by testStringSystem().
bool phoenix_unsetenv | ( | const std::string & | name | ) |
Unset a environment variable.
name | : name of the variable to be unset |
Definition at line 227 of file string_system.cpp.
Referenced by testStringSystem().