![]() |
PhoenixInkscape
2.0.0
Generate multiple png files with svg inkscape files
|
Path of a directory or a file. More...
#include <PPath.h>
Public Member Functions | |
PString & | add (char ch) |
Add a char to an other. More... | |
PString & | add (const char *str) |
Add a char pointer to an other. More... | |
PString & | add (const PString &other) |
Add a PString to an other. More... | |
PString & | add (const std::string &other) |
Add a std::string to an other. More... | |
bool | changeMode (mode_t __mode=S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) const |
Change the mode of a file or directory. More... | |
bool | checkFileBegning (const PString &expectedBegining) const |
Check if the given file starts with the given begning. More... | |
size_t | count (char ch) const |
Count the number of char ch in the current PString. More... | |
size_t | count (const PString &patern) const |
Count the number of patern in string. More... | |
bool | createDirectory (mode_t mode=0755) const |
Create the current directory. More... | |
PString | eraseChar (char ch) const |
Erase char ch of current string. More... | |
PString | eraseChar (const PString &vecChar) const |
Erase char ch of current string. More... | |
PPath & | eraseExtension () |
Erase the extension of the PPath. More... | |
PPath | eraseExtension () const |
Erase the extension of the PPath. More... | |
PString | eraseFirstChar (const PString &vecChar) const |
Erase first char in a string. More... | |
PString | eraseFirstLastChar (const PString &vecChar) const |
Erase first and last char in a string. More... | |
PString | eraseLastChar (const PString &vecChar) const |
Erase first and last char in a string. More... | |
PPath & | eraseLongestExtension () |
Erase the longest extension of the PPath. More... | |
PPath | eraseLongestExtension () const |
Erase the longest extension of the PPath. More... | |
PString | escapeStr (const PString &strCharToEscape, const PString &escapeSeq) const |
Escape given string with passed characters. More... | |
bool | find (char ch) const |
Find a char in a string. More... | |
bool | find (const PString &listChar) const |
Find multiple chars in a string. More... | |
PString | firstToLower () const |
Convert first letter of the PString in lower case. More... | |
PString | firstToUpper () const |
Convert first letter of the PString in upper case. More... | |
PString | format (const PString &arg) const |
Replace first {} with arg. More... | |
template<typename T > | |
PString & | fromValue (const T &other) |
Convert a value to a PString. More... | |
std::vector< PPath > | getAllDirectoryInDir () const |
Get the list of files in a directory. More... | |
std::vector< PPath > | getAllElementInDir () const |
Get the list of all elements in a directory. More... | |
std::vector< PPath > | getAllFileInDir () const |
Get the list of files in a directory. More... | |
PString | getCommonBegining (const PString &other) const |
Get the common begining between the current PString and other. More... | |
PPath | getDirectoryName () const |
Get the name of the directory, from last char to / (if the last char is not a /, otherwise it takes the chars before last /) More... | |
PString | getExtension () const |
Get file extension. More... | |
time_t | getFileModificationTime () const |
Get the last modification time of the given file. More... | |
PPath | getFileName () const |
Get the name of the file, from last char to /. More... | |
size_t | getFileSize () const |
Get the size of the current file. More... | |
PString | getLongestExtension () const |
Get the longest file extension. More... | |
PPath | getParentDirectory () const |
Get path of parent directory of current path. More... | |
PPath | getParentDirectory (const PPath &subDirName) const |
Get the parent directory which contains subDirName. More... | |
PPath | getUnderPath (const PString &pathPart) const |
Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path') More... | |
bool | isAbsolutePath () const |
Tel if a path is absolute or not. More... | |
bool | isDirectoryExist () const |
Say if the current directory path does exist. More... | |
bool | isExist () const |
Say if the current path does exist. More... | |
bool | isFileExist () const |
Say if the current file path does exist. More... | |
bool | isLowerCase () const |
Say if the given PString is in lowercase. More... | |
bool | isNumber () const |
Say if the given PString is composed of numbers. More... | |
bool | isSameBegining (const PString &beginStr) const |
Say if the current PString has the same begining of beginStr. More... | |
bool | isUpperCase () const |
Say if the given PString is in uppercase. More... | |
PString | loadFileContent () const |
Get the file content in a PString. More... | |
PPath | makeAbsolute () const |
Make an absolute path of the given path. More... | |
PString & | merge (const std::vector< PString > &vecStr, const PString &separator="") |
Merge a set of PString. More... | |
PString & | operator+= (char ch) |
Add a char to an other. More... | |
PString & | operator+= (const PString &other) |
Add a PString to an other. More... | |
PString & | operator+= (const std::string &other) |
Add a std::string to an other. More... | |
template<typename T > | |
PString & | operator+= (const T &other) |
Append type in PString. More... | |
template<typename T > | |
PString & | operator<< (const T &other) |
Append type in PString. More... | |
PPath & | operator= (const PPath &other) |
Definition of equal operator of PPath. More... | |
PPath () | |
Default constructor of PPath. More... | |
PPath (const PPath &other) | |
Copy constructor of PPath. More... | |
PPath (const PString &other) | |
Constructor of PPath. More... | |
PString | replace (const PString &pattern, const PString &replaceStr) const |
Replace a PString into an other PString. More... | |
PString | replace (const PString &pattern, const PString &replaceStr, size_t maxNbReplace) const |
Replace a PString into an other PString. More... | |
PString | replaceChar (const PString &vecChar, const PString &replaceStr) const |
Replace characters in vecChar by replaceStr. More... | |
bool | saveFileContent (const PString &content) const |
Save a PString in a file. More... | |
PPath | simplify () const |
Remove extra dots from the path. More... | |
std::vector< PString > | split (char separator) const |
Cut a PString on the given separator char. More... | |
std::vector< PString > | split (const PString &vecSeparator) const |
Split the PString on any given characters of vecSeparator. More... | |
PString | toLower () const |
Convert PString in lower case. More... | |
PString | toLowerUnderscore () const |
Convert std::string in lower case and space in '_'. More... | |
PString | toUpper () const |
Convert std::string in upper case. More... | |
template<typename T > | |
T | toValue () const |
Convert the current string into a value. More... | |
virtual | ~PPath () |
Destructor of PPath. More... | |
Static Public Member Functions | |
static PPath | getCurrentDirectory () |
Returns the current directory. More... | |
static PString | getCurrentNodeName () |
Get the name of the current node on which the program is running. More... | |
static PPath | getHomeDir () |
Gets the $HOME directory. More... | |
static PPath | getProgramDirectory () |
Get the program directory. More... | |
static PPath | getProgramLocation () |
Get the program location. More... | |
static PPath | getProgramPrefix () |
Get the program prefix (installation directory without /bin) More... | |
template<typename T > | |
static PString | toString (const T &value) |
Convert a value to a PString. More... | |
template<typename T > | |
static T | toValue (const PString &other) |
Convert the given string into a value. More... | |
Protected Member Functions | |
void | concatenatePString (const PString &other) |
Concatenate a PString into the current PString. More... | |
void | concatenatePString (const std::string &other) |
Concatenate a std::string into the current PString. More... | |
void | copyPPath (const PPath &other) |
Copy function of PPath. More... | |
void | copyPString (const PString &other) |
Copy function of PString. More... | |
void | copyPString (const std::string &other) |
Copy function of PString. More... | |
Private Member Functions | |
void | initialisationPPath () |
Initialisation function of the class PPath. More... | |
void | initialisationPString () |
Initialisation function of the class PString. More... | |
Friends | |
PPath | operator/ (const PPath &other1, const PPath &other2) |
Operator / for PPath to concatenate PPath. More... | |
PPath::PPath | ( | ) |
Default constructor of PPath.
Definition at line 64 of file PPath.cpp.
References initialisationPPath().
Referenced by getDirectoryName(), getFileName(), and getParentDirectory().
PPath::PPath | ( | const PString & | other | ) |
Constructor of PPath.
other | : PString |
Definition at line 73 of file PPath.cpp.
References initialisationPPath().
PPath::PPath | ( | const PPath & | other | ) |
Copy constructor of PPath.
other | : class to copy |
Definition at line 82 of file PPath.cpp.
References copyPPath().
|
virtual |
|
inherited |
Add a char to an other.
ch | : char to be added to the current one |
Definition at line 172 of file PString.cpp.
References PString::concatenatePString().
|
inherited |
Add a char pointer to an other.
str | : char pointer to be added to the current one |
Definition at line 183 of file PString.cpp.
References PString::concatenatePString(), and phoenix_charToString().
Add a PString to an other.
other | : PString to be added to the current one |
Definition at line 154 of file PString.cpp.
References PString::concatenatePString().
Referenced by makeAbsolute(), and PString::operator+=().
|
inherited |
Add a std::string to an other.
other | : std::string to be added to the current one |
Definition at line 163 of file PString.cpp.
References PString::concatenatePString().
bool PPath::changeMode | ( | mode_t | __mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | ) | const |
Change the mode of a file or directory.
__mode | : mode to be applied to the given file (Default value makes files executable S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) |
bool PPath::checkFileBegning | ( | const PString & | expectedBegining | ) | const |
|
protectedinherited |
Concatenate a PString into the current PString.
other | : PString to be added |
Definition at line 722 of file PString.cpp.
Referenced by PString::add(), PString::operator+=(), and PString::operator<<().
|
protectedinherited |
Concatenate a std::string into the current PString.
other | : std::string to be added |
Definition at line 732 of file PString.cpp.
|
protected |
Copy function of PPath.
other | : class to copy |
Definition at line 657 of file PPath.cpp.
Referenced by operator=(), and PPath().
|
protectedinherited |
Copy function of PString.
other | : class to copy |
Definition at line 706 of file PString.cpp.
Referenced by PString::fromValue(), operator=(), PString::operator=(), and PString::PString().
|
protectedinherited |
Copy function of PString.
other | : class to copy |
Definition at line 714 of file PString.cpp.
|
inherited |
Count the number of char ch in the current PString.
ch | : char to be counted |
Definition at line 323 of file PString.cpp.
Referenced by getLongestExtension().
|
inherited |
Count the number of patern in string.
patern | : patern to be serached |
Definition at line 338 of file PString.cpp.
bool PPath::createDirectory | ( | mode_t | mode = 0755 | ) | const |
Create the current directory.
mode | : access mode of the created directory |
Definition at line 331 of file PPath.cpp.
References isDirectoryExist(), and PString::split().
|
inherited |
Erase char ch of current string.
ch | : char to be removed |
Definition at line 478 of file PString.cpp.
Referenced by PString::eraseChar(), getCurrentNodeName(), and PFileParser::getStrComposedOf().
Erase char ch of current string.
vecChar | : chars to be removed |
Definition at line 490 of file PString.cpp.
References PString::eraseChar().
PPath & PPath::eraseExtension | ( | ) |
Erase the extension of the PPath.
Definition at line 292 of file PPath.cpp.
References getExtension().
Referenced by eraseExtension(), openFileStream(), processFileSvg(), and PLog::resize().
PPath PPath::eraseExtension | ( | ) | const |
Erase first char in a string.
vecChar | : chars to be searched and removed |
Definition at line 502 of file PString.cpp.
References PString::find().
Referenced by checkEraseFirstChars(), and PString::eraseFirstLastChar().
Erase first and last char in a string.
vecChar | : chars to be searched and removed |
Definition at line 545 of file PString.cpp.
References PString::eraseFirstChar(), and PString::eraseLastChar().
Referenced by checkEraseFirstLastChars(), and DicoValue::getString().
Erase first and last char in a string.
vecChar | : chars to be searched and removed |
Definition at line 521 of file PString.cpp.
References PString::find().
Referenced by checkEraseLastChars(), and PString::eraseFirstLastChar().
PPath & PPath::eraseLongestExtension | ( | ) |
Erase the longest extension of the PPath.
Definition at line 303 of file PPath.cpp.
References getLongestExtension().
Referenced by eraseLongestExtension().
PPath PPath::eraseLongestExtension | ( | ) | const |
|
inherited |
Escape given string with passed characters.
strCharToEscape | : list of the characters to be escaped |
escapeSeq | : escape sequence (could be one char) |
Definition at line 689 of file PString.cpp.
References PString::find().
Referenced by phoenix_listArgToString().
|
inherited |
Find a char in a string.
ch | : char to be searched |
Definition at line 371 of file PString.cpp.
Referenced by PString::eraseFirstChar(), PString::eraseLastChar(), PString::escapeStr(), PString::find(), getExtension(), PFileParser::getNextToken(), getParentDirectory(), PFileParser::getStrComposedOf(), PFileParser::getUntilKeyWithoutPaternRecurse(), PFileParser::isChSeparator(), PFileParser::isChSpace(), PFileParser::isMatch(), PFileParser::isMatchToken(), PFileParser::isWhiteSpace(), PString::replaceChar(), DicoValue::saveRecurse(), PFileParser::skipChars(), PFileParser::skipWhiteSpace(), and PString::split().
|
inherited |
Find multiple chars in a string.
listChar | : chars to be searched |
Definition at line 384 of file PString.cpp.
References PString::find().
|
inherited |
Convert first letter of the PString in lower case.
Definition at line 659 of file PString.cpp.
References phoenix_isCharUpperCase().
|
inherited |
Convert first letter of the PString in upper case.
Definition at line 673 of file PString.cpp.
References phoenix_isCharLowerCase().
Replace first {} with arg.
arg | : PString to be replaced |
Definition at line 298 of file PString.cpp.
References PString::replace().
Referenced by checkFormat().
|
inherited |
Convert a value to a PString.
other | : value to be converted |
Definition at line 36 of file PString_impl.h.
References PString::copyPString(), and valueToString().
Referenced by checkValueToStringConvertion(), and OptionValue::setDefaultValue().
std::vector< PPath > PPath::getAllDirectoryInDir | ( | ) | const |
Get the list of files in a directory.
Definition at line 479 of file PPath.cpp.
Referenced by testPPathListAllFileInDir().
std::vector< PPath > PPath::getAllElementInDir | ( | ) | const |
Get the list of all elements in a directory.
Definition at line 503 of file PPath.cpp.
Referenced by testPPathListAllFileInDir().
std::vector< PPath > PPath::getAllFileInDir | ( | ) | const |
Get the list of files in a directory.
Definition at line 457 of file PPath.cpp.
Referenced by testPPathListAllFileInDir().
Get the common begining between the current PString and other.
other | : string |
Definition at line 399 of file PString.cpp.
|
static |
Returns the current directory.
Definition at line 636 of file PPath.cpp.
References phoenix_charToString(), and phoenix_getenv().
Referenced by makeAbsolute(), and testPPathGetProgram().
|
static |
Get the name of the current node on which the program is running.
Definition at line 650 of file PPath.cpp.
References PString::eraseChar(), and phoenix_popen().
Referenced by testPPathGetProgram().
PPath PPath::getDirectoryName | ( | ) | const |
PString PPath::getExtension | ( | ) | const |
Get file extension.
Definition at line 252 of file PPath.cpp.
References PString::find(), and PString::PString().
Referenced by eraseExtension(), openFileStream(), and PLog::resize().
time_t PPath::getFileModificationTime | ( | ) | const |
Get the last modification time of the given file.
fileName | : name of the file we want the last modification time |
PPath PPath::getFileName | ( | ) | const |
Get the name of the file, from last char to /.
Definition at line 172 of file PPath.cpp.
References PPath().
Referenced by path_completion_all(), path_completion_dirOnly(), processFileSvg(), and testFromJSonToJSon().
size_t PPath::getFileSize | ( | ) | const |
Get the size of the current file.
|
static |
Gets the $HOME directory.
Definition at line 629 of file PPath.cpp.
References phoenix_getenv().
Referenced by testPPathGetProgram().
PString PPath::getLongestExtension | ( | ) | const |
Get the longest file extension.
Definition at line 268 of file PPath.cpp.
References PString::count().
Referenced by eraseLongestExtension().
PPath PPath::getParentDirectory | ( | ) | const |
Get path of parent directory of current path.
Definition at line 207 of file PPath.cpp.
References PString::find(), PPath(), and PString::PString().
Referenced by getParentDirectory(), getProgramDirectory(), getProgramPrefix(), path_completion_all(), and path_completion_dirOnly().
Get the parent directory which contains subDirName.
subDirName | : name of the searched sub-directory |
Definition at line 228 of file PPath.cpp.
References getParentDirectory(), and isDirectoryExist().
|
static |
Get the program directory.
Definition at line 606 of file PPath.cpp.
References getParentDirectory(), getProgramLocation(), and PString::PString().
Referenced by getProgramPrefix(), and testPPathGetProgram().
|
static |
Get the program location.
Definition at line 585 of file PPath.cpp.
References PString::PString().
Referenced by getProgramDirectory(), and testPPathGetProgram().
|
static |
Get the program prefix (installation directory without /bin)
Definition at line 622 of file PPath.cpp.
References getParentDirectory(), and getProgramDirectory().
Referenced by testPPathGetProgram().
Get path which is under the given pathPart ('some/dir/path' with 'dir' will return 'path')
pathPart | : directory in the fileName we are looking for |
Definition at line 360 of file PPath.cpp.
References PString::split().
|
private |
|
privateinherited |
Initialisation function of the class PString.
Definition at line 740 of file PString.cpp.
Referenced by PString::PString().
bool PPath::isAbsolutePath | ( | ) | const |
Tel if a path is absolute or not.
path | : path to be checked |
Definition at line 164 of file PPath.cpp.
Referenced by makeAbsolute().
bool PPath::isDirectoryExist | ( | ) | const |
Say if the current directory path does exist.
Definition at line 151 of file PPath.cpp.
Referenced by createDirectory(), getParentDirectory(), path_completion_all(), and path_completion_dirOnly().
bool PPath::isExist | ( | ) | const |
bool PPath::isFileExist | ( | ) | const |
Say if the current file path does exist.
Definition at line 139 of file PPath.cpp.
Referenced by loadFileContent(), path_completion_all(), and pinkscape_isSlideKnown().
|
inherited |
Say if the given PString is in lowercase.
Definition at line 568 of file PString.cpp.
References phoenix_isCharLowerCase().
|
inherited |
Say if the given PString is composed of numbers.
Definition at line 583 of file PString.cpp.
References phoenix_isCharNumber().
|
inherited |
Say if the current PString has the same begining of beginStr.
beginStr | : begining string to check |
Definition at line 306 of file PString.cpp.
Referenced by ArgParser::ArgParser(), completePathDir(), OptionParser::getLongOptionValue(), OptionMode::getPossibleMode(), Option::getPossibleOption(), OptionMode::getPossibleOption(), OptionParser::getPossibleOtherOption(), Option::parsePartOption(), path_completion_all(), and path_completion_dirOnly().
|
inherited |
Say if the given PString is in uppercase.
Definition at line 553 of file PString.cpp.
References phoenix_isCharUpperCase().
PString PPath::loadFileContent | ( | ) | const |
Get the file content in a PString.
Definition at line 382 of file PPath.cpp.
References isFileExist(), and phoenix_getFileContent().
Referenced by PFileParser::open(), and pxml_parserFile().
PPath PPath::makeAbsolute | ( | ) | const |
Make an absolute path of the given path.
Definition at line 572 of file PPath.cpp.
References PString::add(), getCurrentDirectory(), and isAbsolutePath().
|
inherited |
|
inherited |
Add a char to an other.
ch | : char to be added to the current one |
Definition at line 146 of file PString.cpp.
References PString::add().
Add a PString to an other.
other | : PString to be added to the current one |
Definition at line 130 of file PString.cpp.
References PString::add().
|
inherited |
Add a std::string to an other.
other | : std::string to be added to the current one |
Definition at line 138 of file PString.cpp.
References PString::add().
|
inherited |
Append type in PString.
other | : type to be appended |
Definition at line 67 of file PString_impl.h.
References PString::concatenatePString(), and valueToString().
|
inherited |
Append type in PString.
other | : type to be appended |
Definition at line 78 of file PString_impl.h.
References PString::concatenatePString(), and valueToString().
Definition of equal operator of PPath.
other | : class to copy |
Definition at line 97 of file PPath.cpp.
References copyPPath(), and PString::copyPString().
Replace a PString into an other PString.
pattern | : pattern to be replaced |
replaceStr | : string to replace |
Definition at line 204 of file PString.cpp.
Referenced by ArgParser::ArgParser(), checkPStringReplace(), PString::format(), and saveDico().
|
inherited |
Replace a PString into an other PString.
pattern | : pattern to be replaced |
replaceStr | : string to replace |
maxNbReplace | : maximum number of replace to perform in the string |
Definition at line 243 of file PString.cpp.
|
inherited |
Replace characters in vecChar by replaceStr.
vecChar | : set of characters to be replaced |
replaceStr | : replacement string |
Definition at line 282 of file PString.cpp.
References PString::find().
bool PPath::saveFileContent | ( | const PString & | content | ) | const |
Save a PString in a file.
content | : file content |
Definition at line 395 of file PPath.cpp.
Referenced by checkParseXmlFile(), checkPMultiFileParser(), checkTestParseSeq(), phoenix_popen(), pxml_saveFile(), DicoValue::save(), saveSlides(), testDicoBadParsing(), and testDicoGoodParsing().
PPath PPath::simplify | ( | ) | const |
Remove extra dots from the path.
Definition at line 533 of file PPath.cpp.
References PString::PString(), and PString::split().
|
inherited |
Cut a PString on the given separator char.
separator | : separtor char |
Definition at line 420 of file PString.cpp.
Referenced by checkResultSeparator(), createDirectory(), createVectorSlide(), getUnderPath(), and simplify().
Split the PString on any given characters of vecSeparator.
vecSeparator | : PString of separator characters |
Definition at line 439 of file PString.cpp.
References PString::find().
|
inherited |
Convert PString in lower case.
Definition at line 598 of file PString.cpp.
References phoenix_isCharUpperCase().
Referenced by phoenix_convertBoolType().
|
inherited |
Convert std::string in lower case and space in '_'.
Definition at line 618 of file PString.cpp.
References phoenix_isCharUpperCase().
|
staticinherited |
Convert a value to a PString.
value | : value to be converted |
Definition at line 18 of file PString_impl.h.
References valueToString().
Referenced by testPString(), and testPStringConversion().
|
inherited |
Convert std::string in upper case.
Definition at line 639 of file PString.cpp.
References phoenix_isCharLowerCase().
|
inherited |
Convert the current string into a value.
Definition at line 46 of file PString_impl.h.
|
staticinherited |
Convert the given string into a value.
other | : PString to be converted |
Definition at line 27 of file PString_impl.h.
Referenced by checkValueToStringConvertion().