Isis 3.0 Object Programmers' Reference |
Home |
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. | |
FileName (const char *fileName) | |
FileName (const QString &fileName) | |
FileName (const FileName &other) | |
~FileName () | |
Destroys the FileName object. | |
QString | originalPath () const |
QString | path () const |
Returns the path. | |
QString | attributes () const |
QString | baseName () const |
QString | name () const |
QString | extension () const |
QString | expanded () const |
QString | original () const |
FileName | addExtension (const QString &extension) const |
FileName | removeExtension () const |
FileName | setExtension (const QString &extension) const |
bool | isVersioned () const |
bool | isNumericallyVersioned () const |
bool | isDateVersioned () const |
FileName | highestVersion () const |
FileName | newVersion () const |
FileName | version (long versionNumber) const |
FileName | version (QDate versionDate) const |
bool | fileExists () const |
QDir | dir () const |
QString | toString () const |
FileName & | operator= (const FileName &rhs) |
Clears the current contents of the FileName object and reinitializes it with the argument. | |
bool | operator== (const FileName &rhs) |
bool | operator!= (const FileName &rhs) |
Static Public Member Functions | |
static FileName | createTempFile (FileName templateFileName="$TEMPORARY/temp") |
Private Member Functions | |
QDate | highestVersionDate () const |
long | highestVersionNum () const |
void | validateVersioningState () const |
This verifies the class invariant when using versioning - that the FileName is in an acceptable state to find file version numbers. | |
QString | fileNameQDatePattern () const |
QPair< QString, QString > | splitNameAroundVersionNum () const |
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.
Definition at line 109 of file FileName.h.
Isis::FileName::FileName | ( | ) |
Constructs an empty FileName object.
Definition at line 44 of file FileName.cpp.
Referenced by validateVersioningState().
Isis::FileName::~FileName | ( | ) |
Destroys the FileName object.
Definition at line 66 of file FileName.cpp.
Clears the current contents of the FileName object and reinitializes it with the argument.
file | File name to replace the current contents of the object. |
Definition at line 340 of file FileName.cpp.
References m_d.
QString Isis::FileName::path | ( | ) | const |
Returns the path.
for a full file specification of: "/home/me/img/picture.jpg" path() gives: "/home/me/img"
Definition at line 88 of file FileName.cpp.
Referenced by Isis::ProcessPolygons::AppendOutputCube(), Isis::PipelineApplication::CalculateOutputFile(), Isis::Image::copyToNewProjectRoot(), Isis::Image::deleteFromDisk(), Isis::ProcessExportPds::ExportTable(), Isis::Pipeline::FinalOutput(), Isis::Blob::Find(), Isis::ImportPdsTable::load(), Isis::ImportPdsTable::loadLabel(), Isis::QnetFileTool::open(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessImportPds::ProcessLabel(), Isis::Cube::realDataFileName(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::ControlList::save(), Isis::ImageList::save(), Isis::ProcessGroundPolygons::SetStatCubes(), Isis::ProcessPolygons::SetStatCubes(), Isis::MeasureTool::updateDist(), and Isis::AdvancedTrackTool::updateRow().
|
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 471 of file FileName.cpp.
References _FILEINFO_, FileName(), and Isis::IException::Unknown.
|
private |