COPASI API
4.16.103
|
#include <CDirEntry.h>
Static Public Member Functions | |
static std::string | baseName (const std::string &path) |
static std::vector< std::string > | compilePattern (const std::string &pattern) |
static bool | createDir (const std::string &dir, const std::string &parent="") |
static std::string | createTmpName (const std::string &dir, const std::string &suffix) |
static std::string | dirName (const std::string &path) |
static bool | exist (const std::string &path) |
static std::string | fileName (const std::string &path) |
static bool | isDir (const std::string &path) |
static bool | isFile (const std::string &path) |
static bool | isReadable (const std::string &path) |
static bool | isRelativePath (const std::string &path) |
static bool | isWritable (const std::string &path) |
static bool | makePathAbsolute (std::string &relativePath, const std::string &absoluteTo) |
static bool | makePathRelative (std::string &absolutePath, const std::string &relativeTo) |
static bool | match (const std::string &name, const std::vector< std::string > &patternList) |
static bool | move (const std::string &from, const std::string &to) |
static std::string | normalize (const std::string &path) |
static bool | remove (const std::string &path) |
static bool | removeFiles (const std::string &pattern, const std::string &dir) |
static std::string | suffix (const std::string &path) |
Static Public Attributes | |
static const std::string | Separator = "/" |
Static Private Member Functions | |
static bool | matchInternal (const std::string &name, const std::string pattern, std::string::size_type &at, std::string::size_type &after) |
This class provides an OS independent interface to directory entries such as files and directories.
Definition at line 28 of file CDirEntry.h.
|
static |
Returns the base name, i.e., the directory path and the the suffix are removed from 'path'.
const | std::string & path |
Definition at line 98 of file CDirEntry.cpp.
References Separator.
Referenced by CCopasiDataModel::autoSave(), CCopasiDataModel::importSBML(), CCopasiDataModel::loadModel(), main(), CopasiUI3Window::slotExportMathModel(), CopasiUI3Window::slotExportSBML(), and CopasiUI3Window::updateTitle().
|
static |
Compiles the pattern to a patternList. Valid wildcards in the pattern are: '*' matches any number of characters and '?' matches exactly one character.
const | std::string & pattern |
Definition at line 372 of file CDirEntry.cpp.
References min.
Referenced by removeFiles().
|
static |
Create the directory 'dir' in the parent directory 'parent'.
const | std::string & dir |
const | std::string & parent (Default: current working directory) |
Definition at line 180 of file CDirEntry.cpp.
References CLocaleString::fromUtf8(), isDir(), isWritable(), and Separator.
Referenced by COptions::getConfigDir(), and COptions::getTemp().
|
static |
Create a name for a temporary directory entry. The directory entry will be located in the directory given
const | std::string & dir |
const | std::string & suffix |
Definition at line 202 of file CDirEntry.cpp.
References C_INT32, CRandom::createGenerator(), exist(), CRandom::getRandomU(), pdelete, Separator, and suffix().
Referenced by CCopasiDataModel::saveModel().
|
static |
Returns the directory path to the parent directoryu, i.e., the file name or directory name are removed from 'path'.
const | std::string & path |
Definition at line 135 of file CDirEntry.cpp.
References Separator.
Referenced by CCopasiDataModel::exportMathModel(), CSEDMLExporter::exportModelAndTasks(), COptions::getCopasiDir(), CopasiFileDialog::getOpenFileName(), CopasiFileDialog::getSaveFileName(), SEDMLImporter::importFirstSBMLModel(), CCopasiDataModel::importSBML(), COptions::init(), CCopasiDataModel::loadModel(), makePathAbsolute(), makePathRelative(), CopasiUI3Window::slotExportMathModel(), CopasiUI3Window::slotExportSBML(), and CopasiFileDialog::StartWith().
|
static |
Check whether the directory entry specified by 'path' exists.
const | std::string & path |
Definition at line 78 of file CDirEntry.cpp.
References CLocaleString::fromUtf8().
Referenced by createTmpName(), createUniqueModelFileName(), CCopasiDataModel::exportMathModel(), CCopasiDataModel::exportSBML(), SEDMLImporter::importFirstSBMLModel(), move(), and CCopasiDataModel::saveModel().
|
static |
Returns the file name, i.e., the directory path is removed from 'path'.
const | std::string & path |
Definition at line 119 of file CDirEntry.cpp.
References Separator.
Referenced by CRecentFiles::addFile(), CCopasiDataModel::exportSBML(), CExperiment::getFileName(), CopasiFileDialog::getSaveFileName(), CCopasiDataModel::importSBML(), CQExperimentData::load(), CCopasiDataModel::loadModel(), move(), CReport::open(), CCopasiDataModel::saveModel(), CCopasiXMLInterface::saveParameter(), CCopasiXML::saveSBMLReference(), CCopasiXML::saveTaskList(), CCopasiDataModel::setSBMLFileName(), CQExperimentData::slotFileAdd(), and Copasi2SBMLTranslator::translate().
|
static |
Check whether the directory entry specified by 'path' is is a directory.
const | std::string & path |
Definition at line 65 of file CDirEntry.cpp.
References CLocaleString::fromUtf8().
Referenced by createDir(), COptions::getTemp(), makePathAbsolute(), makePathRelative(), move(), CopasiFileDialog::openExampleDir(), remove(), and removeFiles().
|
static |
Check whether the directory entry specified by 'path' is a file.
const | std::string & path |
Definition at line 52 of file CDirEntry.cpp.
References CLocaleString::fromUtf8().
Referenced by makePathAbsolute(), makePathRelative(), move(), and remove().
|
static |
Check whether the directory entry specified by 'path' is is readable.
const | std::string & path |
Definition at line 92 of file CDirEntry.cpp.
References CLocaleString::fromUtf8().
|
static |
Checks whether the given path is relative
Definition at line 414 of file CDirEntry.cpp.
References normalize().
Referenced by CRecentFiles::addFile(), CCopasiDataModel::exportSBML(), CExperiment::getFileName(), CCopasiDataModel::importSBML(), COptions::init(), CCopasiDataModel::loadModel(), makePathAbsolute(), makePathRelative(), CReport::open(), CCopasiDataModel::saveModel(), CCopasiXMLInterface::saveParameter(), CCopasiXML::saveSBMLReference(), CCopasiXML::saveTaskList(), and CCopasiDataModel::setSBMLFileName().
|
static |
Check whether the directory entry specified by 'path' is writable.
const | std::string & path |
Definition at line 95 of file CDirEntry.cpp.
References CLocaleString::fromUtf8().
Referenced by checkSelection(), createDir(), CCopasiDataModel::exportMathModel(), CCopasiDataModel::exportSBML(), COptions::getTemp(), CCopasiDataModel::saveModel(), and CopasiUI3Window::slotFileOpenFinished().
|
static |
Makes the relative path absolute to the path given in absoluteTo
std::string | & relativePath |
const | std::string & absoluteTo |
Definition at line 481 of file CDirEntry.cpp.
References dirName(), isDir(), isFile(), isRelativePath(), and normalize().
Referenced by CRecentFiles::addFile(), CCopasiDataModel::exportSBML(), CExperiment::getFileName(), CCopasiDataModel::importSBML(), COptions::init(), CCopasiDataModel::loadModel(), CReport::open(), CCopasiDataModel::saveModel(), CCopasiDataModel::setSBMLFileName(), CLImageTexturizer::to_absolute_path(), and Copasi2SBMLTranslator::translate().
|
static |
Makes the absolute path relative to the path given in relativeTo
std::string | & absolutePath |
const | std::string & relativeTo |
Definition at line 434 of file CDirEntry.cpp.
References dirName(), isDir(), isFile(), isRelativePath(), min, and normalize().
Referenced by CCopasiXMLInterface::saveParameter(), CCopasiXML::saveSBMLReference(), and CCopasiXML::saveTaskList().
|
static |
Compare the name against the pattern list and returns whether the name matches. The patternList can be created from a pattern by the compilePattern method.
const | std::string & name |
const | std::vector< std::string > & patternList |
Definition at line 398 of file CDirEntry.cpp.
References matchInternal().
Referenced by removeFiles().
|
staticprivate |
This private methods checks whether the active section matches the secified patter. The section is automatically advanced to allow repeated calls. On the first call 'at' must be 0. The parameters 'at' and 'after' must not be changed outside this method.
const | std::string & name |
const | std::string pattern |
std::string::size_type | & at |
std::string::size_type | & after |
Definition at line 506 of file CDirEntry.cpp.
Referenced by match().
|
static |
Move a file from. If to is the directory the filename of from is appended.
const | std::string & from |
const | std::string & to |
Definition at line 233 of file CDirEntry.cpp.
References exist(), fileName(), CLocaleString::fromUtf8(), isDir(), isFile(), and Separator.
Referenced by CCopasiDataModel::saveModel().
|
static |
This method normalizes the path, i.e., it converts all '\' to '/' (only on WIN32) and collapses '^./' to '^', '/./' to '/', and '[^/]+/../' to '/'
const | std::string & path |
Definition at line 560 of file CDirEntry.cpp.
References COptions::getValue().
Referenced by CRecentFiles::addFile(), CCopasiDataModel::importSBML(), isRelativePath(), CCopasiDataModel::loadModel(), makePathAbsolute(), makePathRelative(), CCopasiDataModel::saveModel(), and CCopasiDataModel::setSBMLFileName().
|
static |
Removes a file or directory specified by path.
const | std::string & path |
Definition at line 275 of file CDirEntry.cpp.
References CLocaleString::fromUtf8(), isDir(), and isFile().
Referenced by CopasiUI3Window::CleanUp(), CCopasiDataModel::saveModel(), and Copasi2SBMLTranslator::translate().
|
static |
Remove files or directories matching the pattern in directory dir.
const | std::string & pattern |
const | std::string & dir |
Definition at line 290 of file CDirEntry.cpp.
References compilePattern(), CLocaleString::fromUtf8(), isDir(), match(), Separator, and CLocaleString::toUtf8().
Referenced by CopasiUI3Window::CleanUp().
|
static |
Returns the suffix, i.e., the directory path and the the base name are removed from 'path'.
const | std::string & path |
Definition at line 159 of file CDirEntry.cpp.
References Separator.
Referenced by createTmpName(), CopasiFileDialog::getSaveFileName(), CCopasiDataModel::importSBML(), CCopasiDataModel::loadModel(), and CopasiUI3Window::slotFileOpenFinished().
|
static |
The character used to separate directory entries.
Definition at line 34 of file CDirEntry.h.
Referenced by CCopasiDataModel::autoSave(), baseName(), createDir(), createTmpName(), createUniqueModelFileName(), dirName(), CSEDMLExporter::exportModelAndTasks(), fileName(), COptions::getConfigDir(), COptions::getConfigFile(), COptions::getTemp(), SEDMLImporter::importFirstSBMLModel(), CCopasiDataModel::importSBML(), CConfigurationFile::load(), CCopasiDataModel::loadModel(), move(), removeFiles(), CopasiUI3Window::slotExportMathModel(), CopasiUI3Window::slotExportSBML(), and suffix().