Isis 3 Programmer Reference
|
File name manipulation and expansion. More...
#include <FileName.h>
Classes | |
class | Data |
This is the reference-counted data for FileName. More... | |
Public Member Functions | |
FileName () | |
Constructs an empty FileName object. More... | |
FileName (const char *fileName) | |
Constructs a FileName object using a char pointer as a file name. More... | |
FileName (const QString &fileName) | |
Constructs a FileName object using a QString as a file name. More... | |
FileName (const FileName &other) | |
Constructs a copy of a FileName object using another FileName object. More... | |
~FileName () | |
Destroys the FileName object. More... | |
QString | originalPath () const |
Returns the path of the original file name. More... | |
QString | path () const |
Returns the path of the file name. More... | |
QString | attributes () const |
Returns a QString of the attributes in a filename, attributes are expected to be of type CubeAttributeInput or CubeAttributeOutput. More... | |
QString | baseName () const |
Returns the name of the file without the path and without extensions. More... | |
QString | name () const |
Returns the name of the file excluding the path and the attributes in the file name. More... | |
QString | extension () const |
Returns the last extension of the file name. More... | |
QString | expanded () const |
Returns a QString of the full file name including the file path, excluding the attributes. More... | |
QString | original () const |
Returns the full file name including the file path. More... | |
FileName | addExtension (const QString &extension) const |
Adds a new extension to the file name. More... | |
FileName | removeExtension () const |
Removes all extensions in the file name. More... | |
FileName | setExtension (const QString &extension) const |
Sets all current file extensions to a new extension in the file name. More... | |
bool | isVersioned () const |
Checks to see if a file name is versioned by date or numerically. More... | |
bool | isNumericallyVersioned () const |
Checks if the file name is versioned numerically. More... | |
bool | isDateVersioned () const |
Checks if the file name is versioned by date. More... | |
FileName | highestVersion () const |
Searches the directory specified in the file name for the highest version of the file name. More... | |
FileName | newVersion () const |
Updates the file name to be the latest version. More... | |
bool | fileExists () const |
Returns true if the file exists; false otherwise. More... | |
QDir | dir () const |
Returns the path of the file's parent directory as a QDir object. More... | |
QString | toString () const |
Returns a QString of the full file name including the file path, excluding the attributes with any Isis Preferences or environment variables indicated by $, changed to what they represent. More... | |
FileName & | operator= (const FileName &rhs) |
Clears the current contents of the FileName object and reinitializes it with the argument. More... | |
bool | operator== (const FileName &rhs) |
Compares equality of two FileName objects. More... | |
bool | operator!= (const FileName &rhs) |
Compares equality of two FileName objects. More... | |
Static Public Member Functions | |
static FileName | createTempFile (FileName templateFileName="$TEMPORARY/temp") |
Creates a temporary file and returns a FileName object created using the temporary file. More... | |
Private Member Functions | |
FileName | version (long versionNumber) const |
Returns a FileName object of the same file name but versioned numerically by the number passed in as a parameter. More... | |
FileName | version (QDate versionDate) const |
Returns a FileName object of the same file name but versioned by the date passed in as a parameter. More... | |
QDate | highestVersionDate () const |
This looks through the directory of the file and checks for the highest version date of the file that is versioned date. More... | |
long | highestVersionNum () const |
This looks through the directory of the file and checks for the highest version number of the file that is versioned numerically. More... | |
void | validateVersioningState () const |
This verifies the class invariant when using versioning - that the FileName is in an acceptable state to find file version numbers. More... | |
QString | fileNameQDatePattern () const |
This changes the files format. More... | |
QPair< QString, QString > | splitNameAroundVersionNum () const |
This returns a QPair of the text (before, after) a version number in a file. More... | |
Private Attributes | |
QSharedDataPointer< Data > | m_d |
File name manipulation and expansion.
This class is used for manipulating filenames. It allows access to the path, extension, base name and Isis attributes. A standard Isis filename takes the form of
For example:
2002-11-27 Stuart Sides - added capability to expand environment variables within a filename.
2003-01-27 Jeff Anderson - added a method to allow full file specification to be extracted (includes the attributes).
2002-02-12 Stuart Sides - fixed bug with incorrect parsing when filename did not have a path.
2003-05-16 Stuart Sides - modified schema from astrogeology...isis.astrogeology.
2003-07-21 Stuart Sides - modified to use "+" as the attribute delimiter instead of a ":".
2003-10-17 ?????? - Added default constructor, operator "=" and temporary members.
2003-10-30 ?????? - Added new members: HighestVersion and Exists.
2003-12-03 ?????? - Added capability to expand Preferences in the DataDirectory group only.
2004-01-14 ?????? - Added new member OriginalPath.
2004-01-22 ?????? - Added new member Name. Name returns the filename only without any path, extension or attributes.
2004-01-27 ?????? - Tool all references to attributes out. IsisFileName now ignores all cube attributes.
2004-01-27 ?????? - Removed the member FullSpecification, because FullSpecification without the cube attributes now does the same thing as FileName.
2004-01-27 ?????? - Added a new constructor with two parameters. This new constructor will create a temporary filename using the path from the Preference DataDirectory/Temporary the filename from argument one appended with a number from 100000 to 199999 and the extension of argument two.
2004-05-17 ?????? - Added new member MakeDirectory.
2005-07-28 Drew Davidson - added new member NewVersion.
2007-10-03 Steven Koechle - Fixed Temporary() so if a path was specified it will have the cwd put on in front of it.
2009-01-07 Steven Lambright - expanded() no longer behaves differently for unit tests
2011-08-19 Jeannie Backer - Modified unitTest to use $temporary variable instead of /tmp directory. Added some documentation to methods.
2011-08-24 Steven Lambright and Tracie Sucharski - Uses QString instead of QString for simplicity when used with our GUI applications. Removed extra includes and cleaned up code a little.
2012-04-14 Steven Lambright - Renamed FileName to FileName. No longer inherits QFileInfo, paired down functionality to file name related functionality. Fixed temporary file naming to guarantee unique, unpredictable (safe) names.
2012-06-04 Steven Lambright and Stuart Sides - Added operator!= and improved unit test to include tests of operator== and operator!=. Fixes #903.
2014-07-23 Jeannie Backer - Moved ifndef to top of file to bring class closer to ISIS coding standards and removed include for std::string.
2016-06-21 Kris Becker - Properly forward declare QPair as struct not class
2017-04-21 Cole Neubauer - Updated documentation for the class Fixes #4121
2018-04-06 Kaitlyn Lee - Moved method documentation to cpp file and updated it for consistency. Fixes #5230.
2019-08-07 Jesse Mapel - Replaced QDate::fromFile call with QLocale::toDate calls to ensure US English is always used. Fixes #3340
Definition at line 116 of file FileName.h.
Isis::FileName::FileName | ( | ) |
Constructs an empty FileName object.
Definition at line 47 of file FileName.cpp.
Referenced by addExtension(), createTempFile(), fileNameQDatePattern(), highestVersionDate(), highestVersionNum(), isDateVersioned(), isNumericallyVersioned(), removeExtension(), splitNameAroundVersionNum(), validateVersioningState(), and version().
Isis::FileName::FileName | ( | const char * | file | ) |
Constructs a FileName object using a char pointer as a file name.
file | char pointer representing new filename |
Definition at line 56 of file FileName.cpp.
References Isis::FileName::Data::setOriginal().
Isis::FileName::FileName | ( | const QString & | file | ) |
Constructs a FileName object using a QString as a file name.
file | Qstring representing new filename |
Definition at line 66 of file FileName.cpp.
References Isis::FileName::Data::setOriginal().
Isis::FileName::FileName | ( | const FileName & | other | ) |
Constructs a copy of a FileName object using another FileName object.
&other | FileName object to copy. |
Definition at line 76 of file FileName.cpp.
Isis::FileName::~FileName | ( | ) |
Destroys the FileName object.
Definition at line 82 of file FileName.cpp.
FileName Isis::FileName::addExtension | ( | const QString & | newExtension | ) | const |
Adds a new extension to the file name.
If the current extension is the same as the new extension it will return an unchanged FileName object.
newExtension | The new file extension to be added at the end of the file name after all exisiting extensions. |
Definition at line 241 of file FileName.cpp.
References attributes(), extension(), FileName(), name(), and originalPath().
Referenced by Isis::ImageExporter::createWorldFile(), IsisAml::GetFileName(), Isis::Cube::initLabelFromFile(), Isis::TextFile::Open(), setExtension(), Isis::JP2Exporter::write(), Isis::TiffExporter::write(), Isis::QtExporter::write(), Isis::ImageExporter::write(), and Isis::Cube::write().
QString Isis::FileName::attributes | ( | ) | const |
Returns a QString of the attributes in a filename, attributes are expected to be of type CubeAttributeInput or CubeAttributeOutput.
Filenames without any attributes return an empty QString.
for a full file specification of: "/tmp/Peaks.cub+Bsq" attributes() gives: "Bsq"
Definition at line 137 of file FileName.cpp.
Referenced by Isis::CubeAttribute< CubeAttributeInput >::addAttributes(), addExtension(), removeExtension(), and Isis::CubeAttribute< CubeAttributeInput >::setAttributes().
QString Isis::FileName::baseName | ( | ) | const |
Returns the name of the file without the path and without extensions.
for a full file specification of: "/tmp/Peaks.cub.gz" baseName() gives: "Peaks"
Definition at line 161 of file FileName.cpp.
Referenced by Isis::ProcessPolygons::AppendOutputCube(), Isis::PipelineApplication::BuildParamString(), Isis::PipelineApplication::CalculateOutputFile(), createTempFile(), Isis::EmbreeTargetShape::EmbreeTargetShape(), Isis::Pipeline::FinalOutput(), Isis::Equalization::generateOutputs(), Isis::ProcessExportPds4::identificationArea(), Isis::ImportPdsTable::load(), removeExtension(), Isis::Kernels::resolveTypeByExt(), Isis::ProcessGroundPolygons::SetStatCubes(), Isis::ProcessPolygons::SetStatCubes(), and Isis::ProcessExportPds4::WritePds4().
Creates a temporary file and returns a FileName object created using the temporary file.
templateFileName | the file name used to create the temporary file. |
Isis::IException::Io |
Definition at line 494 of file FileName.cpp.
References _FILEINFO_, baseName(), extension(), FileName(), Isis::IException::Io, original(), originalPath(), and path().
QDir Isis::FileName::dir | ( | ) | const |
Returns the path of the file's parent directory as a QDir object.
for a full file specification of: "/tmp/Peaks.cub+Bsq" dir() gives: "/tmp/"
Definition at line 481 of file FileName.cpp.
References expanded().
Referenced by Isis::Control::copyToNewProjectRoot(), Isis::Shape::copyToNewProjectRoot(), Isis::Image::copyToNewProjectRoot(), highestVersionDate(), highestVersionNum(), Isis::TemplateList::save(), Isis::ShapeList::save(), Isis::ControlList::save(), Isis::ImageList::save(), Isis::GuiFileNameParameter::SelectFile(), Isis::Control::updateFileName(), Isis::Shape::updateFileName(), Isis::Image::updateFileName(), Isis::BundleSolutionInfo::updateFileName(), and Isis::UserInterface::UserInterface().
QString Isis::FileName::expanded | ( | ) | const |
Returns a QString of the full file name including the file path, excluding the attributes.
Any Isis Preferences or environment variables indicated by $, are changed to what they represent.
for a full file specification of: QString(ISISROOT) + "/tmp/Peaks.cub+Bsq" expanded() gives: "/usgs/pkgs/isis3/isis/tmp/Peaks.cub"
Any Isis Preferences or environment variables indicated by $, are changed to what they represent.
for a full file specification of: "$ISISROOT/tmp/Peaks.cub+Bsq" expanded() gives: "/usgs/pkgs/isis3/isis/tmp/Peaks.cub"
Definition at line 212 of file FileName.cpp.
Referenced by Isis::HelpTool::aboutProgram(), Isis::SerialNumberList::add(), Isis::ImageExporter::addChannel(), Isis::CubeDataThread::AddCube(), Isis::PushFrameCameraCcdLayout::addKernel(), Isis::Pvl::append(), Isis::Application::Application(), Isis::Blob::Blob(), Isis::ControlPointEditWidget::checkGroundFileLocation(), Isis::CnetEditorView::CnetEditorView(), Isis::CorrelationMatrix::computeCorrelationMatrix(), Isis::ControlPointList::ControlPointList(), Isis::TiffImporter::convertProjection(), Isis::Cube::copy(), Isis::ProjectionFactory::Create(), Isis::Spice::createCache(), Isis::ControlPointEditWidget::createControlPoint(), Isis::ControlMeasureEditWidget::createMeasureEditor(), Isis::QnetNavTool::createNavigationDialog(), Isis::ImageImporter::createOutput(), Isis::ControlPointEdit::createPointEditor(), Isis::ImageExporter::createWorldFile(), Isis::Shape::deleteFromDisk(), Isis::Image::deleteFromDisk(), dir(), Isis::ProcessExportPds4::displaySettings(), Isis::Module::Dump(), Isis::EmbreeTargetShape::EmbreeTargetShape(), Isis::Kernels::examine(), Isis::ImportRegistrationTemplateWorkOrder::execute(), Isis::ImportMapTemplateWorkOrder::execute(), Isis::ProcessImportFits::extraFitsLabel(), Isis::ProcessExportPds4::fileAreaObservational(), fileExists(), Isis::SerialNumberList::fileNameIndex(), fileNameQDatePattern(), Isis::ObservationNumber::FindObservationTranslation(), Isis::SerialNumber::FindSerialTranslation(), Isis::ProcessImportFits::fitsImageLabel(), Isis::ImageImporter::fromFileName(), Isis::EmbreeTargetManager::fullFilePath(), Isis::ControlNetStatistics::GeneratePointStats(), Isis::Application::GetEnviromentInfo(), IsisAml::GetFileName(), Isis::MosaicTool::getIcon(), Isis::Application::GetLibraryDependencies(), Isis::Plugin::GetPlugin(), Isis::Application::GetSystemDiskSpace(), Isis::Application::GetUnameInfo(), Isis::GuiFileNameParameter::GuiFileNameParameter(), highestVersionDate(), highestVersionNum(), Isis::ProcessExportPds4::identificationArea(), Isis::Cube::initLabelFromFile(), Isis::CameraFactory::initPlugin(), Isis::BundleSolutionInfo::inputControlNetFileName(), isDateVersioned(), isNumericallyVersioned(), Isis::JP2Importer::JP2Importer(), Isis::ImportPdsTable::load(), Isis::Spice::load(), Isis::BulletDskShape::loadFromDsk(), Isis::UserInterface::loadHistory(), Isis::KernelDb::loadKernelDbFiles(), Isis::iTime::LoadLeapSecondKernel(), Isis::Mariner10Camera::Mariner10Camera(), Isis::Process::MissionData(), Isis::CubePlotCurve::mousePressEvent(), Isis::ObservationNumberList::observationNumber(), Isis::JigsawRunWidget::on_JigsawAcceptButton_clicked(), Isis::TextFile::Open(), Isis::MosaicControlNetTool::openControlNet(), Isis::CubeManager::OpenCube(), Isis::NaifDskPlateModel::openDSK(), Isis::operator<<(), operator==(), Isis::BundleSolutionInfo::outputHeader(), Isis::XmlToPvlTranslationManager::parseFile(), path(), Isis::ControlNetStatistics::PrintImageStats(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), Isis::ProcessImport::ProcessBsq(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessImportPds::ProcessLabel(), Isis::ProcessImportPds::ProcessPdsCombinedSpectrumLabel(), Isis::ProcessImportPds::ProcessPdsImageLabel(), Isis::ProcessImportPds::ProcessPdsM3Label(), Isis::ProcessImportPds::ProcessPdsQubeLabel(), Isis::Project::Project(), Isis::CorrelationMatrix::pvlObject(), Isis::PvlTranslationTable::PvlTranslationTable(), Isis::QIsisApplication::QIsisApplication(), Isis::QtImporter::QtImporter(), Isis::Target::radiiGroup(), Isis::Pvl::read(), Isis::ControlNetVersioner::read(), Isis::EmbreeTargetShape::readDSK(), Isis::OriginalXmlLabel::readFromXmlFile(), Isis::ImageOverlapSet::ReadImageOverlaps(), Isis::KernelDb::readKernelDbFiles(), Isis::PvlConstraints::readKeyListFile(), Isis::EmbreeTargetShape::readPC(), Isis::ControlNetVersioner::readProtobufV0001(), Isis::ControlNetVersioner::readProtobufV0002(), Isis::ControlNetVersioner::readProtobufV0005(), Isis::PaletteWindow::readSettings(), Isis::FileDialog::readSettings(), Isis::SpecialPixelTool::readSettings(), Isis::FeatureNomenclatureTool::readSettings(), Isis::MatchTool::readSettings(), Isis::QnetTool::readSettings(), Isis::Cube::realDataFileLabel(), Isis::Cube::realDataFileName(), Isis::Cube::reformatOldIsisLabel(), Isis::Cube::reopen(), Isis::Kernels::resolveType(), Isis::ProjectionFactory::RingsCreate(), Isis::ProgramLauncher::RunIsisProgram(), Isis::BundleSolutionInfo::save(), Isis::UserInterface::SaveHistory(), Isis::ScatterPlotWindow::ScatterPlotWindow(), Isis::GuiFileNameParameter::SelectFile(), Isis::SerialNumberList::serialNumber(), Isis::MatchTool::serialNumberList(), Isis::CorrelationMatrix::setCovarianceFileName(), Isis::ProcessImportFits::setFitsFile(), Isis::ControlPointEditWidget::setGroundSourceInfo(), Isis::Pipeline::SetInputListFile(), Isis::MdiCubeViewport::setLinked(), Isis::ControlNetFilter::SetOutputFile(), Isis::Pipeline::SetOutputFile(), Isis::Pipeline::SetOutputListFile(), Isis::AdvancedTrackTool::settingsFilePath(), Isis::ImportShapesWorkOrder::setupExecution(), Isis::ImportImagesWorkOrder::setupExecution(), Isis::MosaicMainWindow::setupMenus(), Isis::SpectralDefinition2D::SpectralDefinition2D(), splitNameAroundVersionNum(), Isis::ProcessExportPds::StandardImageImage(), Isis::ProcessExportPds4::standardInstrument(), Isis::ProcessExportPds::StandardJP2Image(), Isis::TiffImporter::TiffImporter(), Isis::Tool::Tool(), toString(), Isis::ProcessExportPds4::translateBandBinImage(), Isis::ProcessExportPds4::translateBandBinSpectrumBinSet(), Isis::ProcessExportPds4::translateBandBinSpectrumUniform(), Isis::ProcessImportPds::TranslateIsis2BandBin(), Isis::ProcessImportPds::TranslateIsis2Instrument(), Isis::ProcessImportPds::TranslatePdsArchive(), Isis::ProcessImportPds::TranslatePdsBandBin(), Isis::ProcessImportPds::TranslatePdsProjection(), Isis::BundleSolutionInfo::updateFileName(), Isis::BlinkTool::updateTool(), validateVersioningState(), IsisAml::Verify(), version(), Isis::VikingCamera::VikingCamera(), Isis::VoyagerCamera::VoyagerCamera(), Isis::WarningWidget::WarningWidget(), Isis::JP2Exporter::write(), Isis::TiffExporter::write(), Isis::QtExporter::write(), Isis::Pvl::write(), Isis::Cube::write(), Isis::ControlNetVersioner::write(), Isis::ImageOverlapSet::WriteImageOverlaps(), Isis::ProcessExportPds4::WritePds4(), Isis::PaletteWindow::writeSettings(), Isis::FileDialog::writeSettings(), Isis::SpecialPixelTool::writeSettings(), Isis::FeatureNomenclatureTool::writeSettings(), Isis::MatchTool::writeSettings(), Isis::QnetTool::writeSettings(), and Isis::Spice::~Spice().
QString Isis::FileName::extension | ( | ) | const |
Returns the last extension of the file name.
for a full file specification of: "/tmp/Peaks.cub.gz" extension() gives: "gz"
Definition at line 194 of file FileName.cpp.
Referenced by addExtension(), Isis::ProcessPolygons::AppendOutputCube(), Isis::ShapeModelFactory::create(), createTempFile(), Isis::EmbreeTargetShape::EmbreeTargetShape(), Isis::Equalization::generateOutputs(), Isis::BulletTargetShape::load(), Isis::Kernels::resolveTypeByExt(), setExtension(), Isis::ImportShapesWorkOrder::setupExecution(), Isis::ImportImagesWorkOrder::setupExecution(), and Isis::ProcessExportPds4::WritePds4().
bool Isis::FileName::fileExists | ( | ) | const |
Returns true if the file exists; false otherwise.
If the file is a symlink that points to a nonexistent file, false is returned.
Definition at line 465 of file FileName.cpp.
References expanded().
Referenced by Isis::DatabaseFactory::addAccessProfile(), Isis::Application::Application(), Isis::ControlPointEditWidget::checkGroundFileLocation(), Isis::TiffImporter::convertProjection(), Isis::InterestOperatorFactory::Create(), Isis::PolygonSeederFactory::Create(), Isis::AtmosModelFactory::Create(), Isis::PhotoModelFactory::Create(), Isis::AutoRegFactory::Create(), Isis::NormModelFactory::Create(), Isis::ProjectionFactory::Create(), Isis::Kernels::examine(), Isis::Cube::initLabelFromFile(), Isis::CameraFactory::initPlugin(), Isis::OpenProjectWorkOrder::isExecutable(), Isis::ImportPdsTable::load(), Isis::Spice::load(), Isis::BulletDskShape::loadFromDsk(), Isis::UserInterface::loadHistory(), Isis::ControlPointEditWidget::loadPoint(), Isis::KernelDb::loadSystemDb(), Isis::Process::MissionData(), newVersion(), Isis::TextFile::Open(), Isis::NaifDskPlateModel::openDSK(), Isis::operator<<(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::EmbreeTargetShape::readDSK(), Isis::ProjectionFactory::RingsCreate(), Isis::UserInterface::SaveHistory(), Isis::ControlPointEditWidget::setGroundSourceInfo(), Isis::ImportImagesWorkOrder::setupExecution(), Isis::Directory::updateRecentProjects(), Isis::UserInterface::UserInterface(), and IsisAml::Verify().
|
private |
This changes the files format.
Specifically quotes everything not in {} with single quotes and removes the {} from the file name.
Definition at line 743 of file FileName.cpp.
References expanded(), and FileName().
Referenced by highestVersionDate(), and version().
FileName Isis::FileName::highestVersion | ( | ) | const |
Searches the directory specified in the file name for the highest version of the file name.
Returns a FileName object with the file name changed to reflect the highest version.
Definition at line 329 of file FileName.cpp.
References _FILEINFO_, highestVersionDate(), highestVersionNum(), isDateVersioned(), isNumericallyVersioned(), isVersioned(), name(), originalPath(), Isis::IException::Unknown, validateVersioningState(), and version().
Referenced by Isis::PushFrameCameraCcdLayout::addKernel(), Isis::KernelDb::files(), Isis::ObservationNumber::FindObservationTranslation(), Isis::SerialNumber::FindSerialTranslation(), Isis::KernelDb::loadKernelDbFiles(), Isis::iTime::LoadLeapSecondKernel(), Isis::Process::MissionData(), and Isis::Target::radiiGroup().
|
private |
This looks through the directory of the file and checks for the highest version date of the file that is versioned date.
Definition at line 594 of file FileName.cpp.
References _FILEINFO_, dir(), expanded(), FileName(), fileNameQDatePattern(), name(), path(), and Isis::IException::Unknown.
Referenced by highestVersion().
|
private |
This looks through the directory of the file and checks for the highest version number of the file that is versioned numerically.
Definition at line 656 of file FileName.cpp.
References _FILEINFO_, dir(), expanded(), FileName(), name(), path(), splitNameAroundVersionNum(), and Isis::IException::Unknown.
Referenced by highestVersion(), and newVersion().
bool Isis::FileName::isDateVersioned | ( | ) | const |
Checks if the file name is versioned by date.
Returns true if the file is versioned by date; returns false otherwise.
Definition at line 319 of file FileName.cpp.
References expanded(), and FileName().
Referenced by highestVersion(), isVersioned(), newVersion(), and validateVersioningState().
bool Isis::FileName::isNumericallyVersioned | ( | ) | const |
Checks if the file name is versioned numerically.
Returns true if the file is versioned numerically; returns false otherwise.
Definition at line 309 of file FileName.cpp.
References expanded(), and FileName().
Referenced by highestVersion(), isVersioned(), newVersion(), and splitNameAroundVersionNum().
bool Isis::FileName::isVersioned | ( | ) | const |
Checks to see if a file name is versioned by date or numerically.
Returns true if file is versioned by date or numerically; returns false otherwise.
Definition at line 297 of file FileName.cpp.
References isDateVersioned(), isNumericallyVersioned(), and validateVersioningState().
Referenced by Isis::PushFrameCameraCcdLayout::addKernel(), Isis::KernelDb::files(), highestVersion(), and newVersion().
QString Isis::FileName::name | ( | ) | const |
Returns the name of the file excluding the path and the attributes in the file name.
for a full file specification of: "/tmp/Peaks.cub+Bsq" name() gives: "Peaks.cub"
Definition at line 178 of file FileName.cpp.
Referenced by addExtension(), Isis::Application::Application(), Isis::ControlPointEditWidget::checkReference(), Isis::QnetTool::checkReference(), Isis::ControlNetDiff::compare(), Isis::ObservationNumber::Compose(), Isis::SerialNumber::Compose(), Isis::Control::copyToNewProjectRoot(), Isis::Shape::copyToNewProjectRoot(), Isis::Image::copyToNewProjectRoot(), Isis::QnetPointCubeNameFilter::createCubeList(), Isis::MatchTool::createPoint(), Isis::UserInterface::evaluateOption(), Isis::Kernels::examine(), Isis::ImportRegistrationTemplateWorkOrder::execute(), Isis::ImportMapTemplateWorkOrder::execute(), Isis::TrackingTable::fileNameToPixel(), Isis::KernelDb::files(), Isis::QnetNavTool::filterList(), Isis::ProcessExportPds::FixedImageRoot(), Isis::ProcessExportPds::FixedJP2ImageRoot(), Isis::ControlMeasure::GetChooserName(), Isis::CorrelationMatrix::hasCovMat(), highestVersion(), highestVersionDate(), highestVersionNum(), Isis::CorrelationMatrix::isValid(), Isis::ImportPdsTable::load(), Isis::UserInterface::loadCommandLine(), Isis::ControlPointEditWidget::loadGroundMeasure(), Isis::QnetTool::loadGroundMeasure(), Isis::ControlPointEditWidget::loadPoint(), Isis::MatchTool::loadPoint(), Isis::QnetTool::loadPoint(), newVersion(), Isis::Cube::open(), Isis::ImportShapesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), Isis::ImportControlNetWorkOrder::CreateControlsFunctor::operator()(), Isis::ImportImagesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), Isis::JigsawRunWidget::CopyImageToResultsFunctor::operator()(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ControlNetVersioner::read(), Isis::ControlNetVersioner::readProtobufV0001(), Isis::ControlNetVersioner::readProtobufV0002(), Isis::ControlNetVersioner::readProtobufV0005(), Isis::Cube::realDataFileName(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::Cube::reformatOldIsisLabel(), Isis::QnetNavTool::resetList(), Isis::ProgramLauncher::RunIsisProgram(), Isis::BundleSolutionInfo::save(), Isis::Project::save(), Isis::GuiFileNameParameter::SelectFile(), Isis::MatchTool::serialNumberList(), Isis::ProcessMapMosaic::StartProcess(), Isis::ProcessExportPds::StreamImageRoot(), Isis::ProcessExportPds::StreamJP2ImageRoot(), Isis::AdvancedTrackTool::TrackMosaicOrigin(), Isis::MeasureTool::updateDist(), Isis::Template::updateFileName(), Isis::Control::updateFileName(), Isis::Shape::updateFileName(), Isis::Image::updateFileName(), Isis::BundleSolutionInfo::updateFileName(), Isis::AdvancedTrackTool::updateRow(), Isis::ControlPointEditWidget::validateMeasureChange(), Isis::Cube::write(), Isis::Cube::writeLabels(), and Isis::ProcessExportPds4::WritePds4().
FileName Isis::FileName::newVersion | ( | ) | const |
Updates the file name to be the latest version.
If the file is versioned by date the newest version will be the current date. If the file is versioned numerically, the newest version will be the current version plus one.
Isis::IException::Unknown |
Definition at line 364 of file FileName.cpp.
References _FILEINFO_, fileExists(), highestVersionNum(), isDateVersioned(), isNumericallyVersioned(), isVersioned(), name(), originalPath(), Isis::IException::Unknown, validateVersioningState(), and version().
bool Isis::FileName::operator!= | ( | const FileName & | rhs | ) |
Compares equality of two FileName objects.
Returns false if the two objects are equal and true otherwise.
Definition at line 584 of file FileName.cpp.
Clears the current contents of the FileName object and reinitializes it with the argument.
rhs | FileName to replace the current contents of the object. |
Definition at line 543 of file FileName.cpp.
bool Isis::FileName::operator== | ( | const FileName & | rhs | ) |
Compares equality of two FileName objects.
Returns true if the two objects are equal and false otherwise.
Definition at line 556 of file FileName.cpp.
References expanded().
QString Isis::FileName::original | ( | ) | const |
Returns the full file name including the file path.
for a full file specification of: QString(ISISROOT) + "/tmp/Peaks.cub+Bsq" original() gives: QString(ISISROOT) + "/tmp/Peaks.cub+Bsq"
for a full file specification of: "$ISISROOT/tmp/Peaks.cub+Bsq" original() gives: "$ISISROOT/tmp/Peaks.cub+Bsq"
Definition at line 228 of file FileName.cpp.
Referenced by Isis::Cube::copy(), createTempFile(), Isis::Cube::initLabelFromFile(), Isis::Cube::open(), Isis::Cube::realDataFileName(), Isis::Cube::relocateDnData(), Isis::Project::save(), Isis::Pipeline::SetInputFile(), Isis::FileName::Data::setOriginal(), Isis::ImportShapesWorkOrder::setupExecution(), and Isis::ImportImagesWorkOrder::setupExecution().
QString Isis::FileName::originalPath | ( | ) | const |
Returns the path of the original file name.
For *nix operating systems this includes everything up to but not including the last slash "/". For filenames created without any slashes the current working directory will be returned.
for a full file specification of: "/home/me/img/picture.jpg" originalPath() gives: "/home/me/img"
Definition at line 100 of file FileName.cpp.
References path().
Referenced by Isis::Directory::addBundleObservationView(), addExtension(), createTempFile(), Isis::KernelDb::files(), highestVersion(), newVersion(), Isis::Cube::open(), removeExtension(), version(), and Isis::ProcessExportPds4::WritePds4().
QString Isis::FileName::path | ( | ) | const |
Returns the path of the file name.
For *nix operating systems this includes everything up to but not including the last slash "/". For filenames created without any slashes the current working directory will be returned.
for a full file specification of: "/home/me/img/picture.jpg" path() gives: "/home/me/img"
Definition at line 119 of file FileName.cpp.
References expanded().
Referenced by Isis::ProcessPolygons::AppendOutputCube(), Isis::PipelineApplication::CalculateOutputFile(), Isis::Shape::copyToNewProjectRoot(), Isis::Image::copyToNewProjectRoot(), createTempFile(), Isis::Shape::deleteFromDisk(), Isis::Image::deleteFromDisk(), Isis::Pipeline::FinalOutput(), Isis::Blob::Find(), Isis::Equalization::generateOutputs(), highestVersionDate(), highestVersionNum(), Isis::ImportPdsTable::load(), Isis::ImportPdsTable::loadLabel(), Isis::QnetFileTool::open(), Isis::JigsawRunWidget::CopyImageToResultsFunctor::operator()(), originalPath(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessImportPds::ProcessLabel(), Isis::Cube::realDataFileName(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::TemplateList::save(), Isis::ShapeList::save(), Isis::ControlList::save(), Isis::ImageList::save(), Isis::BundleSolutionInfo::save(), Isis::ProcessPolygons::SetStatCubes(), Isis::ProcessGroundPolygons::SetStatCubes(), Isis::ImportShapesWorkOrder::setupExecution(), Isis::ImportImagesWorkOrder::setupExecution(), Isis::MeasureTool::updateDist(), and Isis::AdvancedTrackTool::updateRow().
FileName Isis::FileName::removeExtension | ( | ) | const |
Removes all extensions in the file name.
Definition at line 262 of file FileName.cpp.
References attributes(), baseName(), FileName(), and originalPath().
Referenced by Isis::ImageExporter::createWorldFile(), setExtension(), and Isis::Cube::write().
FileName Isis::FileName::setExtension | ( | const QString & | newExtension | ) | const |
Sets all current file extensions to a new extension in the file name.
newExtension | The new file extension to replace any current file extensions with |
Definition at line 281 of file FileName.cpp.
References addExtension(), extension(), and removeExtension().
Referenced by Isis::Shape::copyToNewProjectRoot(), Isis::Image::copyToNewProjectRoot(), Isis::Shape::deleteFromDisk(), Isis::Image::deleteFromDisk(), Isis::Cube::initLabelFromFile(), Isis::ImportShapesWorkOrder::OriginalFileToProjectCubeFunctor::operator()(), and Isis::ImportImagesWorkOrder::OriginalFileToProjectCubeFunctor::operator()().
|
private |
This returns a QPair of the text (before, after) a version number in a file.
Before being the text before the version number and after being the text after the version number.
Definition at line 773 of file FileName.cpp.
References expanded(), FileName(), and isNumericallyVersioned().
Referenced by highestVersionNum(), and version().
QString Isis::FileName::toString | ( | ) | const |
Returns a QString of the full file name including the file path, excluding the attributes with any Isis Preferences or environment variables indicated by $, changed to what they represent.
for a full file specification of: QString(ISISROOT) + "/tmp/Peaks.cub+Bsq" toString() gives: "/usgs/pkgs/isis3/isis/tmp/Peaks.cub"
for a full file specification of: "$ISISROOT/tmp/Peaks.cub+Bsq" toString() gives: "/usgs/pkgs/isis3/isis/tmp/Peaks.cub"
Definition at line 531 of file FileName.cpp.
References expanded().
Referenced by Isis::Control::copyToNewProjectRoot(), Isis::Shape::copyToNewProjectRoot(), Isis::Image::copyToNewProjectRoot(), Isis::Cube::Cube(), Isis::ProcessImportFits::extractFitsLabels(), Isis::ProcessImportFits::extraFitsLabel(), Isis::ProcessImportFits::fitsImageLabel(), Isis::ControlPointEditWidget::loadPoint(), Isis::JigsawRunWidget::on_JigsawAcceptButton_clicked(), Isis::TextFile::Open(), Isis::FileList::read(), Isis::Cube::read(), Isis::Cube::realDataFileLabel(), Isis::Cube::realDataFileName(), Isis::TemplateList::save(), Isis::ShapeList::save(), Isis::ControlList::save(), Isis::ImageList::save(), Isis::BundleSolutionInfo::save(), Isis::Project::save(), Isis::ProcessImportFits::setFitsFile(), Isis::SpectralDefinition1D::SpectralDefinition1D(), Isis::SpectralDefinition2D::SpectralDefinition2D(), version(), and Isis::FileList::write().
|
private |
This verifies the class invariant when using versioning - that the FileName is in an acceptable state to find file version numbers.
Definition at line 695 of file FileName.cpp.
References _FILEINFO_, expanded(), FileName(), isDateVersioned(), and Isis::IException::Unknown.
Referenced by highestVersion(), isVersioned(), and newVersion().
|
private |
Returns a FileName object of the same file name but versioned numerically by the number passed in as a parameter.
versionNumber | number to version the new FileName object |
Isis::IException::Unknown |
Definition at line 414 of file FileName.cpp.
References _FILEINFO_, expanded(), FileName(), originalPath(), splitNameAroundVersionNum(), and Isis::IException::Unknown.
Referenced by highestVersion(), and newVersion().
|
private |
Returns a FileName object of the same file name but versioned by the date passed in as a parameter.
versionDate | QDate to version the new FileName object |
Definition at line 453 of file FileName.cpp.
References FileName(), fileNameQDatePattern(), originalPath(), and toString().