COPASI API
4.40.278
|
#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 | copy (const std::string &from, const std::string &to) |
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.
|
static |
Returns the base name, i.e., the directory path and the the suffix are removed from 'path'.
const | std::string & path |
References Separator.
Referenced by CDataModel::autoSave(), CDataModel::copyExperimentalDataTo(), CSEDMLExporter::createModel(), CDataModel::exportShinyArchive(), CDataModel::getDefaultFileName(), CDataModel::importSBML(), CDataModel::importSEDML(), CDataModel::loadFromFile(), and CDataModel::loadModel().
|
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 |
References min.
Referenced by removeFiles().
|
static |
Move a file from. If to is the directory the filename of from is appended.
const | std::string & from |
const | std::string & to |
References fileName(), CLocaleString::fromUtf8(), isDir(), isFile(), and Separator.
Referenced by CModelVersionHierarchy::addVersion(), and CModelVersionHierarchy::restoreVersion().
|
static |
Create the directory 'dir' in the parent directory 'parent'.
const | std::string & dir |
const | std::string & parent (Default: current working directory) |
References CLocaleString::fromUtf8(), isDir(), isWritable(), and Separator.
Referenced by CModelVersionHierarchy::addVersion(), COptions::getConfigDir(), COptions::getTemp(), and CDataModel::openCombineArchive().
|
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 |
References C_INT32, CRandom::createGenerator(), CLocaleString::fromUtf8(), CRandom::getRandomU(), isDir(), isWritable(), pdelete, Separator, suffix(), and CLocaleString::toUtf8().
Referenced by CDataModel::loadFromString(), CDataModel::openCombineArchive(), CDataModel::saveModel(), and CModelVersionHierarchy::updateVersionXML().
|
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 |
References Separator.
Referenced by CModelVersionHierarchy::addVersion(), CDataModel::exportMathModel(), CSEDMLExporter::exportModelAndTasks(), COptions::getCopasiDir(), CDataModel::getDefaultFileName(), CDataModel::importSBML(), CDataModel::importSEDML(), COptions::init(), CDataModel::loadFromFile(), CDataModel::loadModel(), makePathAbsolute(), makePathRelative(), CDataModel::openCombineArchive(), SEDMLImporter::resolveModelFile(), CConfigurationFile::save(), CFunctionDB::save(), and CDataModel::saveModel().
|
static |
Check whether the directory entry specified by 'path' exists.
const | std::string & path |
References CLocaleString::fromUtf8().
Referenced by CDataModel::copyExperimentalDataTo(), createUniqueModelFileName(), CDataModel::exportCombineArchive(), CDataModel::exportMathModel(), CDataModel::exportSBML(), CDataModel::exportSEDML(), CDataModel::exportShinyArchive(), SEDMLImporter::importModel(), COptions::init(), loadDefaultStyles(), move(), CDataModel::openCombineArchive(), CModelVersionHierarchy::readVersionXML(), SEDMLImporter::resolveModelFile(), and CDataModel::saveModel().
|
static |
Returns the file name, i.e., the directory path is removed from 'path'.
const | std::string & path |
References Separator.
Referenced by CRecentFiles::addFile(), CModelVersionHierarchy::addVersion(), copy(), CDataModel::copyExperimentalDataTo(), CDataModel::exportCombineArchive(), CDataModel::exportSBML(), CDataModel::exportSEDML(), CDataModel::exportShinyArchive(), CExperiment::getFileName(), CDataModel::importSBML(), CDataModel::importSEDML(), CDataModel::loadFromFile(), CDataModel::loadModel(), move(), CReport::open(), CDataModel::openCombineArchive(), CDataModel::saveModel(), CCopasiXML::saveSBMLReference(), CDataModel::setSBMLFileName(), CDataModel::setSEDMLFileName(), and Copasi2SBMLTranslator::translate().
|
static |
Check whether the directory entry specified by 'path' is is a directory.
const | std::string & path |
References CLocaleString::fromUtf8().
Referenced by copy(), createDir(), createTmpName(), COptions::getTemp(), makePathAbsolute(), makePathRelative(), move(), and remove().
|
static |
Check whether the directory entry specified by 'path' is a file.
const | std::string & path |
References CLocaleString::fromUtf8().
Referenced by copy(), makePathAbsolute(), makePathRelative(), move(), and remove().
|
static |
Check whether the directory entry specified by 'path' is is readable.
const | std::string & path |
References CLocaleString::fromUtf8().
|
static |
Checks whether the given path is relative
References normalize().
Referenced by CRecentFiles::addFile(), CDataModel::exportCombineArchive(), CDataModel::exportSBML(), CDataModel::exportSEDML(), CDataModel::exportShinyArchive(), CExperiment::getFileName(), CDataModel::importSBML(), CDataModel::importSEDML(), COptions::init(), CDataModel::loadFromFile(), CDataModel::loadModel(), makePathAbsolute(), makePathRelative(), CReport::open(), CDataModel::openCombineArchive(), CDataModel::saveModel(), CCopasiXMLInterface::saveParameter(), CCopasiXML::saveSBMLReference(), CCopasiXML::saveTaskList(), CDataModel::setSBMLFileName(), and CDataModel::setSEDMLFileName().
|
static |
Check whether the directory entry specified by 'path' is writable.
const | std::string & path |
References CLocaleString::fromUtf8().
Referenced by createDir(), createTmpName(), CDataModel::exportCombineArchive(), CDataModel::exportMathModel(), CDataModel::exportSBML(), CDataModel::exportSEDML(), CDataModel::exportShinyArchive(), COptions::getTemp(), CDataModel::openCombineArchive(), and CDataModel::saveModel().
|
static |
Makes the relative path absolute to the path given in absoluteTo
std::string | & relativePath |
const | std::string & absoluteTo |
References dirName(), isDir(), isFile(), isRelativePath(), and normalize().
Referenced by CRecentFiles::addFile(), CDataModel::copyExperimentalDataTo(), CDataModel::exportCombineArchive(), CDataModel::exportSBML(), CDataModel::exportSEDML(), CDataModel::exportShinyArchive(), CExperiment::getFileName(), CDataModel::importSBML(), CDataModel::importSEDML(), COptions::init(), CDataModel::loadFromFile(), CDataModel::loadModel(), CReport::open(), CDataModel::openCombineArchive(), CDataModel::saveModel(), CDataModel::setSBMLFileName(), CDataModel::setSEDMLFileName(), 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 |
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 |
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 |
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 |
References exist(), fileName(), CLocaleString::fromUtf8(), isDir(), isFile(), remove(), and Separator.
Referenced by CDataModel::saveModel(), and CModelVersionHierarchy::updateVersionXML().
|
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 |
References COptions::getValue().
Referenced by CRecentFiles::addFile(), CDataModel::importSBML(), CDataModel::importSEDML(), isRelativePath(), CDataModel::loadFromFile(), CDataModel::loadModel(), makePathAbsolute(), makePathRelative(), CDataModel::saveModel(), CDataModel::setSBMLFileName(), and CDataModel::setSEDMLFileName().
|
static |
Removes a file or directory specified by path.
const | std::string & path |
References CLocaleString::fromUtf8(), isDir(), and isFile().
Referenced by CModelVersionHierarchy::deleteVersion(), CDataModel::loadFromString(), move(), CDataModel::openCombineArchive(), removeFiles(), CDataModel::saveModel(), Copasi2SBMLTranslator::translate(), and CModelVersionHierarchy::updateVersionXML().
|
static |
Remove files or directories matching the pattern in directory dir.
const | std::string & pattern |
const | std::string & dir |
References compilePattern(), CLocaleString::fromUtf8(), match(), remove(), Separator, and CLocaleString::toUtf8().
Referenced by CModelVersionHierarchy::deleteVersion().
|
static |
Returns the suffix, i.e., the directory path and the the base name are removed from 'path'.
const | std::string & path |
References Separator.
Referenced by createTmpName(), CDataModel::importSBML(), CDataModel::importSEDML(), CDataModel::loadFromFile(), and CDataModel::loadModel().
|
static |
The character used to separate directory entries.
Referenced by CDataModel::autoSave(), baseName(), copy(), createDir(), createTmpName(), createUniqueModelFileName(), dirName(), CSEDMLExporter::exportModelAndTasks(), fileName(), COptions::getConfigDir(), COptions::getConfigFile(), CDataModel::getDefaultFileName(), COptions::getTemp(), CDataModel::importSBML(), CDataModel::importSEDML(), CConfigurationFile::load(), CDataModel::loadFromFile(), CDataModel::loadModel(), move(), removeFiles(), SEDMLImporter::resolveModelFile(), and suffix().