![]() |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
#include <unistd.h>#include <dirent.h>#include <sys/stat.h>#include <sys/types.h>#include "string_utils.h"#include "string_system.h"#include "string_filename.h"
Include dependency graph for string_filename.cpp:Go to the source code of this file.
Functions | |
| bool | checkFileBegning (const std::string &fileName, const std::string &expectedBegining) |
| Check if the given file starts with the given begning. More... | |
| bool | createDirectoriesIfNotExist (const std::string &dirName) |
| Create the directory if not exists. More... | |
| std::string | eraseExtension (const std::string &fileName) |
| Erase extention of the given file. More... | |
| std::string | eraseLongestExtension (const std::string &fileName) |
| Erase longest extention of the given file. More... | |
| std::string | getCurrentDirectory () |
| Returns the current directory. More... | |
| std::string | getDirectory (const std::string &fileName) |
| fonction qui renvoie le dossier parent du fichier More... | |
| std::string | getDirName (const std::string &path) |
| Get the name of the deeper directory. More... | |
| std::string | getExistingFileName (const std::string &fileName, const std::vector< std::string > &vecDirectory) |
| Get the fileName with the directory to get a readable file. More... | |
| std::string | getExtention (const std::string &fileName) |
| Get file extention. More... | |
| std::string | getFileContent (const std::string &filename) |
| Get the file content in a string. More... | |
| std::string | getFileContent (FILE *fp) |
| Get the file content in a string. More... | |
| std::string | getFileName (const std::string &fileName) |
| fonction qui renvoie le nom du fichier du nom complet de fichier passé en paramètre More... | |
| std::string | getLongestExtention (const std::string &fileName) |
| Get the longest file extention. More... | |
| std::string | getUnderPath (const std::string &fileName, const std::string &pathPart) |
| Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path') More... | |
| std::vector< std::string > | getUnderPath (const std::vector< std::string > &vecFileName, const std::string &pathPart) |
| Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path') More... | |
| bool | isAbsolutePath (const std::string &path) |
| Tel if a path is absolute or not. More... | |
| bool | isDirectoryExist (const std::string &dirName) |
| Says if the given direcotry exists. More... | |
| bool | isFileExist (const std::string &fileName) |
| Say if a file exsits or not. More... | |
| bool | isFileOrDirExist (const std::string &fileName) |
| Say if the given path name exsits or not. More... | |
| std::string | makeAbsolutePath (const std::string &path) |
| Make an absolute path of the given path. More... | |
| std::vector< std::string > | makeAbsolutePath (const std::vector< std::string > &vecPath) |
| Make an absolute path of the vector of given paths. More... | |
| std::string | removePathDots (const std::string path) |
| Remove dots from the path. More... | |
| bool | saveFileContent (const std::string &filename, const std::string &content) |
| Save a string in a file. More... | |
| bool | saveFileContent (FILE *fp, const std::string &content) |
| Save a string in a file. More... | |
| bool checkFileBegning | ( | const std::string & | fileName, |
| const std::string & | expectedBegining | ||
| ) |
Check if the given file starts with the given begning.
| fileName | : name of the file to be checked |
| expectedBegining | : expected begening of the file |
Definition at line 212 of file string_filename.cpp.
Referenced by testFileBegning().
Here is the caller graph for this function:| bool createDirectoriesIfNotExist | ( | const std::string & | dirName | ) |
Create the directory if not exists.
| dirName | : name of the directory |
Definition at line 405 of file string_filename.cpp.
References cutStringList(), and isDirectoryExist().
Referenced by testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string eraseExtension | ( | const std::string & | fileName | ) |
Erase extention of the given file.
| fileName | : input file name |
Definition at line 368 of file string_filename.cpp.
References countNbChar().
Referenced by PLog::resize(), splitMock(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string eraseLongestExtension | ( | const std::string & | fileName | ) |
Erase longest extention of the given file.
| fileName | : input file name |
Definition at line 392 of file string_filename.cpp.
References copyStr(), and getLongestExtention().
Referenced by testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string getCurrentDirectory | ( | ) |
Returns the current directory.
Definition at line 69 of file string_filename.cpp.
References phoenix_getenv(), and createReleaseCurl::str.
Referenced by makeAbsolutePath(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string getDirectory | ( | const std::string & | fileName | ) |
fonction qui renvoie le dossier parent du fichier
| fileName | : nom du fichier dont on veut le dossier |
Definition at line 156 of file string_filename.cpp.
Referenced by getProgramDirectory(), getProgramPrefix(), path_completion_all(), path_completion_dirOnly(), and testStringFilename().
Here is the caller graph for this function:| std::string getDirName | ( | const std::string & | path | ) |
Get the name of the deeper directory.
| path | : input path |
Definition at line 246 of file string_filename.cpp.
Referenced by testStringFilename().
Here is the caller graph for this function:| std::string getExistingFileName | ( | const std::string & | fileName, |
| const std::vector< std::string > & | vecDirectory | ||
| ) |
Get the fileName with the directory to get a readable file.
| fileName | : file name to be opened |
| vecDirectory | : vector of possible directories to look at |
Definition at line 42 of file string_filename.cpp.
References isFileExist().
Referenced by testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string getExtention | ( | const std::string & | fileName | ) |
Get file extention.
| fileName | : input file name |
Definition at line 326 of file string_filename.cpp.
References findInString().
Referenced by PLog::resize(), splitMock(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string getFileContent | ( | const std::string & | filename | ) |
Get the file content in a string.
| filename | : file name |
Definition at line 268 of file string_filename.cpp.
References getFileContent().
Referenced by getFileContent(), phoenix_check_fileContent(), phoenix_popen(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string getFileContent | ( | FILE * | fp | ) |
Get the file content in a string.
| fp | : pointer to the file |
Definition at line 283 of file string_filename.cpp.
| std::string getFileName | ( | const std::string & | fileName | ) |
fonction qui renvoie le nom du fichier du nom complet de fichier passé en paramètre
| fileName | : nom complet de fichier dont on veut le nom (/nom/du/fichier -> fichier) |
Definition at line 231 of file string_filename.cpp.
Referenced by path_completion_all(), path_completion_dirOnly(), and testStringFilename().
Here is the caller graph for this function:| std::string getLongestExtention | ( | const std::string & | fileName | ) |
Get the longest file extention.
| fileName | : input file name |
Definition at line 343 of file string_filename.cpp.
References countNbChar().
Referenced by eraseLongestExtension(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string getUnderPath | ( | const std::string & | fileName, |
| const std::string & | pathPart | ||
| ) |
Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path')
| fileName | : path to be used |
| pathPart | : directory in the fileName we are looking for |
Definition at line 176 of file string_filename.cpp.
References cutStringList().
Referenced by getUnderPath(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::vector<std::string> getUnderPath | ( | const std::vector< std::string > & | vecFileName, |
| const std::string & | pathPart | ||
| ) |
Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path')
| vecFileName | : vector of paths to be used |
| pathPart | : directory in the fileName we are looking for |
Definition at line 199 of file string_filename.cpp.
References getUnderPath().
Here is the call graph for this function:| bool isAbsolutePath | ( | const std::string & | path | ) |
Tel if a path is absolute or not.
| path | : path to be checked |
Definition at line 84 of file string_filename.cpp.
Referenced by testStringFilename().
Here is the caller graph for this function:| bool isDirectoryExist | ( | const std::string & | dirName | ) |
Says if the given direcotry exists.
| dirName | : name of the directory |
Definition at line 57 of file string_filename.cpp.
Referenced by createDirectoriesIfNotExist(), createDirIfNotExist(), path_completion_all(), path_completion_dirOnly(), and testStringFilename().
Here is the caller graph for this function:| bool isFileExist | ( | const std::string & | fileName | ) |
Say if a file exsits or not.
| fileName | : name of the file to be checked |
Definition at line 27 of file string_filename.cpp.
Referenced by getExistingFileName(), path_completion_all(), and testStringFilename().
Here is the caller graph for this function:| bool isFileOrDirExist | ( | const std::string & | fileName | ) |
Say if the given path name exsits or not.
| fileName | : name of the file or dir to be checked |
Definition at line 18 of file string_filename.cpp.
Referenced by testStringFilename().
Here is the caller graph for this function:| std::string makeAbsolutePath | ( | const std::string & | path | ) |
Make an absolute path of the given path.
| path | : relative or absolut path (file or dir) |
Definition at line 93 of file string_filename.cpp.
References getCurrentDirectory().
Referenced by makeAbsolutePath(), and testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| std::vector<std::string> makeAbsolutePath | ( | const std::vector< std::string > & | vecPath | ) |
Make an absolute path of the vector of given paths.
| vecPath | : vector of relative or absolute path (file or dir) |
Definition at line 105 of file string_filename.cpp.
References makeAbsolutePath().
Here is the call graph for this function:| std::string removePathDots | ( | const std::string | path | ) |
Remove dots from the path.
| path | : path to be cleaned |
Definition at line 117 of file string_filename.cpp.
References cutStringList().
Referenced by testStringFilename().
Here is the call graph for this function:
Here is the caller graph for this function:| bool saveFileContent | ( | const std::string & | filename, |
| const std::string & | content | ||
| ) |
Save a string in a file.
| filename | : name of the file to be written |
| content | : file content |
Definition at line 300 of file string_filename.cpp.
References saveFileContent().
Referenced by phoenix_popen(), saveFileContent(), testStringFilename(), and testStringSystem().
Here is the call graph for this function:
Here is the caller graph for this function:| bool saveFileContent | ( | FILE * | fp, |
| const std::string & | content | ||
| ) |
Save a string in a file.
| fp | : pointer to the file to be written |
| content | : file content |
Definition at line 316 of file string_filename.cpp.