Isis 3 Programmer Reference
Isis::FileName Class Reference

File name manipulation and expansion. More...

#include <FileName.h>

Collaboration diagram for Isis::FileName:
Collaboration graph

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...
 
FileNameoperator= (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< Datam_d
 

Detailed Description

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

/path/base.extension+attribute

For example:

/work1/mars.cub+5
Author
2002-06-11 Jeff Anderson
Todo:
This class needs an example.
History:

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.

Constructor & Destructor Documentation

◆ FileName() [1/4]

◆ FileName() [2/4]

Isis::FileName::FileName ( const char *  file)

Constructs a FileName object using a char pointer as a file name.

Parameters
filechar pointer representing new filename

Definition at line 56 of file FileName.cpp.

References Isis::FileName::Data::setOriginal().

◆ FileName() [3/4]

Isis::FileName::FileName ( const QString &  file)

Constructs a FileName object using a QString as a file name.

Parameters
fileQstring representing new filename

Definition at line 66 of file FileName.cpp.

References Isis::FileName::Data::setOriginal().

◆ FileName() [4/4]

Isis::FileName::FileName ( const FileName other)

Constructs a copy of a FileName object using another FileName object.

Parameters
&otherFileName object to copy.

Definition at line 76 of file FileName.cpp.

◆ ~FileName()

Isis::FileName::~FileName ( )

Destroys the FileName object.

Definition at line 82 of file FileName.cpp.

Member Function Documentation

◆ addExtension()

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.

Parameters
newExtensionThe new file extension to be added at the end of the file name after all exisiting extensions.
Returns
FileName object with added extension

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().

◆ attributes()

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"
Returns
QString of the attributes specified in the filename.

Definition at line 137 of file FileName.cpp.

Referenced by Isis::CubeAttribute< CubeAttributeInput >::addAttributes(), addExtension(), removeExtension(), and Isis::CubeAttribute< CubeAttributeInput >::setAttributes().

◆ baseName()

◆ createTempFile()

FileName Isis::FileName::createTempFile ( FileName  templateFileName = "$TEMPORARY/temp")
static

Creates a temporary file and returns a FileName object created using the temporary file.

Parameters
templateFileNamethe file name used to create the temporary file.
Returns
FileName object created using the temporary file
Exceptions
Isis::IException::Io

Definition at line 494 of file FileName.cpp.

References _FILEINFO_, baseName(), extension(), FileName(), Isis::IException::Io, original(), originalPath(), and path().

◆ dir()

◆ expanded()

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.

Returns
QString
  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"
Returns
QString

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().

◆ extension()

QString Isis::FileName::extension ( ) const

◆ fileExists()

bool Isis::FileName::fileExists ( ) const

◆ fileNameQDatePattern()

QString Isis::FileName::fileNameQDatePattern ( ) const
private

This changes the files format.

Specifically quotes everything not in {} with single quotes and removes the {} from the file name.

Returns
QString

Definition at line 743 of file FileName.cpp.

References expanded(), and FileName().

Referenced by highestVersionDate(), and version().

◆ highestVersion()

◆ highestVersionDate()

QDate Isis::FileName::highestVersionDate ( ) const
private

This looks through the directory of the file and checks for the highest version date of the file that is versioned date.

Returns
QDate

Definition at line 594 of file FileName.cpp.

References _FILEINFO_, dir(), expanded(), FileName(), fileNameQDatePattern(), name(), path(), and Isis::IException::Unknown.

Referenced by highestVersion().

◆ highestVersionNum()

long Isis::FileName::highestVersionNum ( ) const
private

This looks through the directory of the file and checks for the highest version number of the file that is versioned numerically.

Returns
long

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().

◆ isDateVersioned()

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.

Returns
Boolean

Definition at line 319 of file FileName.cpp.

References expanded(), and FileName().

Referenced by highestVersion(), isVersioned(), newVersion(), and validateVersioningState().

◆ isNumericallyVersioned()

bool Isis::FileName::isNumericallyVersioned ( ) const

Checks if the file name is versioned numerically.

Returns true if the file is versioned numerically; returns false otherwise.

Returns
Boolean

Definition at line 309 of file FileName.cpp.

References expanded(), and FileName().

Referenced by highestVersion(), isVersioned(), newVersion(), and splitNameAroundVersionNum().

◆ isVersioned()

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.

Returns
Boolean

Definition at line 297 of file FileName.cpp.

References isDateVersioned(), isNumericallyVersioned(), and validateVersioningState().

Referenced by Isis::PushFrameCameraCcdLayout::addKernel(), Isis::KernelDb::files(), highestVersion(), and newVersion().

◆ name()

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"
Returns
QString containing every character in the file name exluding the path and attributes of the file.

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().

◆ newVersion()

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.

Returns
FileName object with the new version file name.
Exceptions
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().

◆ operator!=()

bool Isis::FileName::operator!= ( const FileName rhs)

Compares equality of two FileName objects.

Returns false if the two objects are equal and true otherwise.

Parameters
rhsFileName to compare the current FileName object to.
Returns
Boolean

Definition at line 584 of file FileName.cpp.

◆ operator=()

FileName & Isis::FileName::operator= ( const FileName rhs)

Clears the current contents of the FileName object and reinitializes it with the argument.

Parameters
rhsFileName to replace the current contents of the object.
Returns
void

Definition at line 543 of file FileName.cpp.

◆ operator==()

bool Isis::FileName::operator== ( const FileName rhs)

Compares equality of two FileName objects.

Returns true if the two objects are equal and false otherwise.

Parameters
rhsFileName to compare the current FileName object to.
Returns
Boolean

Definition at line 556 of file FileName.cpp.

References expanded().

◆ original()

QString Isis::FileName::original ( ) const

Returns the full file name including the file path.

Returns
QString containing every character in the file name and the 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"
Returns
QString containing every character in the file name and the path

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().

◆ originalPath()

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"
Returns
QString of the path portion of the original filename.

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().

◆ path()

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"
Returns
QString of the path portion of the filename.

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().

◆ removeExtension()

FileName Isis::FileName::removeExtension ( ) const

Removes all extensions in the file name.

Returns
FileName object with all extensions removed

Definition at line 262 of file FileName.cpp.

References attributes(), baseName(), FileName(), and originalPath().

Referenced by Isis::ImageExporter::createWorldFile(), setExtension(), and Isis::Cube::write().

◆ setExtension()

FileName Isis::FileName::setExtension ( const QString &  newExtension) const

Sets all current file extensions to a new extension in the file name.

Parameters
newExtensionThe new file extension to replace any current file extensions with
Returns
FileName object with all existing extensions replaced by the new extension

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()().

◆ splitNameAroundVersionNum()

QPair< QString, QString > Isis::FileName::splitNameAroundVersionNum ( ) const
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.

Returns
QPair

Definition at line 773 of file FileName.cpp.

References expanded(), FileName(), and isNumericallyVersioned().

Referenced by highestVersionNum(), and version().

◆ toString()

QString Isis::FileName::toString ( ) const

◆ validateVersioningState()

void Isis::FileName::validateVersioningState ( ) const
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().

◆ version() [1/2]

FileName Isis::FileName::version ( long  versionNumber) const
private

Returns a FileName object of the same file name but versioned numerically by the number passed in as a parameter.

Parameters
versionNumbernumber to version the new FileName object
Returns
FileName object with the new version file name.
Exceptions
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().

◆ version() [2/2]

FileName Isis::FileName::version ( QDate  versionDate) const
private

Returns a FileName object of the same file name but versioned by the date passed in as a parameter.

Parameters
versionDateQDate to version the new FileName object
Returns
FileName object with the new version file name.

Definition at line 453 of file FileName.cpp.

References FileName(), fileNameQDatePattern(), originalPath(), and toString().


The documentation for this class was generated from the following files: