PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
string_filename.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __STRING_FILENAME_H__
8 #define __STRING_FILENAME_H__
9 
10 #include <stdio.h>
11 #include <string>
12 #include <vector>
13 
14 bool isFileOrDirExist(const std::string & fileName);
15 bool isFileExist(const std::string & fileName);
16 std::string getExistingFileName(const std::string & fileName, const std::vector<std::string> & vecDirectory);
17 bool isDirectoryExist(const std::string & dirName);
18 std::string getCurrentDirectory();
19 bool isAbsolutePath(const std::string & path);
20 std::string makeAbsolutePath(const std::string & path);
21 std::vector<std::string> makeAbsolutePath(const std::vector<std::string> & vecPath);
22 std::string removePathDots(const std::string path);
23 std::string getDirectory(const std::string & fileName);
24 std::string getUnderPath(const std::string & fileName, const std::string & pathPart);
25 std::vector<std::string> getUnderPath(const std::vector<std::string> & vecFileName, const std::string & pathPart);
26 bool checkFileBegning(const std::string & fileName, const std::string & expectedBegining);
27 std::string getFileName(const std::string & fileName);
28 std::string getDirName(const std::string & path);
29 std::string getFileContent(const std::string & filename);
30 std::string getFileContent(FILE* fp);
31 bool saveFileContent(const std::string & filename, const std::string & content);
32 bool saveFileContent(FILE* fp, const std::string & content);
33 std::string getExtention(const std::string & fileName);
34 std::string getLongestExtention(const std::string & fileName);
35 std::string eraseExtension(const std::string & fileName);
36 std::string eraseLongestExtension(const std::string & fileName);
37 
38 bool createDirectoriesIfNotExist(const std::string & dirName);
39 
40 #endif
41 
getUnderPath
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')
Definition: string_filename.cpp:176
checkFileBegning
bool checkFileBegning(const std::string &fileName, const std::string &expectedBegining)
Check if the given file starts with the given begning.
Definition: string_filename.cpp:212
getCurrentDirectory
std::string getCurrentDirectory()
Returns the current directory.
Definition: string_filename.cpp:69
getDirName
std::string getDirName(const std::string &path)
Get the name of the deeper directory.
Definition: string_filename.cpp:246
getExtention
std::string getExtention(const std::string &fileName)
Get file extention.
Definition: string_filename.cpp:326
makeAbsolutePath
std::string makeAbsolutePath(const std::string &path)
Make an absolute path of the given path.
Definition: string_filename.cpp:93
eraseLongestExtension
std::string eraseLongestExtension(const std::string &fileName)
Erase longest extention of the given file.
Definition: string_filename.cpp:392
isDirectoryExist
bool isDirectoryExist(const std::string &dirName)
Says if the given direcotry exists.
Definition: string_filename.cpp:57
isAbsolutePath
bool isAbsolutePath(const std::string &path)
Tel if a path is absolute or not.
Definition: string_filename.cpp:84
getFileContent
std::string getFileContent(const std::string &filename)
Get the file content in a string.
Definition: string_filename.cpp:268
saveFileContent
bool saveFileContent(const std::string &filename, const std::string &content)
Save a string in a file.
Definition: string_filename.cpp:300
getExistingFileName
std::string getExistingFileName(const std::string &fileName, const std::vector< std::string > &vecDirectory)
Get the fileName with the directory to get a readable file.
Definition: string_filename.cpp:42
getDirectory
std::string getDirectory(const std::string &fileName)
fonction qui renvoie le dossier parent du fichier
Definition: string_filename.cpp:156
getFileName
std::string getFileName(const std::string &fileName)
fonction qui renvoie le nom du fichier du nom complet de fichier passé en paramètre
Definition: string_filename.cpp:231
isFileExist
bool isFileExist(const std::string &fileName)
Say if a file exsits or not.
Definition: string_filename.cpp:27
removePathDots
std::string removePathDots(const std::string path)
Remove dots from the path.
Definition: string_filename.cpp:117
getLongestExtention
std::string getLongestExtention(const std::string &fileName)
Get the longest file extention.
Definition: string_filename.cpp:343
isFileOrDirExist
bool isFileOrDirExist(const std::string &fileName)
Say if the given path name exsits or not.
Definition: string_filename.cpp:18
createDirectoriesIfNotExist
bool createDirectoriesIfNotExist(const std::string &dirName)
Create the directory if not exists.
Definition: string_filename.cpp:405
eraseExtension
std::string eraseExtension(const std::string &fileName)
Erase extention of the given file.
Definition: string_filename.cpp:368